diff options
author | Richard M. Stallman <rms@gnu.org> | 1993-03-01 08:58:52 +0000 |
---|---|---|
committer | Richard M. Stallman <rms@gnu.org> | 1993-03-01 08:58:52 +0000 |
commit | 748ef62fff3b51dd4e61b59efb2fbc29e40bf33a (patch) | |
tree | d246443af558cedc4ba0f83cf379265a6effd047 /src/lread.c | |
parent | d4b530ad2db1e26f7c6e6635ecdf3b66b74f3585 (diff) | |
download | emacs-748ef62fff3b51dd4e61b59efb2fbc29e40bf33a.tar.gz emacs-748ef62fff3b51dd4e61b59efb2fbc29e40bf33a.tar.bz2 emacs-748ef62fff3b51dd4e61b59efb2fbc29e40bf33a.zip |
(read1--strings with properties case):
Detect end of list, and invalid syntax, using recursive read1 calls.
(read1): Handle reading strings with properties.
Diffstat (limited to 'src/lread.c')
-rw-r--r-- | src/lread.c | 46 |
1 files changed, 43 insertions, 3 deletions
diff --git a/src/lread.c b/src/lread.c index 45b2265f49e..24671290ab3 100644 --- a/src/lread.c +++ b/src/lread.c @@ -899,11 +899,51 @@ read1 (readcharfun) { /* Accept compiled functions at read-time so that we don't have to build them using function calls. */ - Lisp_Object tmp = read_vector (readcharfun); - return Fmake_byte_code (XVECTOR(tmp)->size, XVECTOR (tmp)->contents); + Lisp_Object tmp; + tmp = read_vector (readcharfun); + return Fmake_byte_code (XVECTOR (tmp)->size, + XVECTOR (tmp)->contents); } +#ifdef USE_TEXT_PROPERTIES + if (c == '(') + { + Lisp_Object tmp; + struct gcpro gcpro1; + + /* Read the string itself. */ + tmp = read1 (readcharfun); + if (XTYPE (tmp) != Lisp_String) + Fsignal (Qinvalid_read_syntax, Fcons (make_string ("#", 1), Qnil)); + GCPRO1 (tmp); + /* Read the intervals and their properties. */ + while (1) + { + Lisp_Object beg, end, plist; + + beg = read1 (readcharfun); + if (XTYPE (beg) == Lisp_Internal) + { + if (XINT (beg) == ')') + break; + Fsignal (Qinvalid_read_syntax, Fcons (make_string ("invalid string property list", 28), Qnil)); + } + end = read1 (readcharfun); + if (XTYPE (end) == Lisp_Internal) + Fsignal (Qinvalid_read_syntax, + Fcons (make_string ("invalid string property list", 28), Qnil)); + + plist = read1 (readcharfun); + if (XTYPE (plist) == Lisp_Internal) + Fsignal (Qinvalid_read_syntax, + Fcons (make_string ("invalid string property list", 28), Qnil)); + Fset_text_properties (beg, end, plist, tmp); + } + UNGCPRO; + return tmp; + } +#endif UNREAD (c); - return Fsignal (Qinvalid_read_syntax, Fcons (make_string ("#", 1), Qnil)); + Fsignal (Qinvalid_read_syntax, Fcons (make_string ("#", 1), Qnil)); case ';': while ((c = READCHAR) >= 0 && c != '\n'); |