aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRichard M. Stallman1993-03-01 08:58:52 +0000
committerRichard M. Stallman1993-03-01 08:58:52 +0000
commit748ef62fff3b51dd4e61b59efb2fbc29e40bf33a (patch)
treed246443af558cedc4ba0f83cf379265a6effd047 /src
parentd4b530ad2db1e26f7c6e6635ecdf3b66b74f3585 (diff)
downloademacs-748ef62fff3b51dd4e61b59efb2fbc29e40bf33a.tar.gz
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')
-rw-r--r--src/lread.c46
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)
899 { 899 {
900 /* Accept compiled functions at read-time so that we don't have to 900 /* Accept compiled functions at read-time so that we don't have to
901 build them using function calls. */ 901 build them using function calls. */
902 Lisp_Object tmp = read_vector (readcharfun); 902 Lisp_Object tmp;
903 return Fmake_byte_code (XVECTOR(tmp)->size, XVECTOR (tmp)->contents); 903 tmp = read_vector (readcharfun);
904 return Fmake_byte_code (XVECTOR (tmp)->size,
905 XVECTOR (tmp)->contents);
904 } 906 }
907#ifdef USE_TEXT_PROPERTIES
908 if (c == '(')
909 {
910 Lisp_Object tmp;
911 struct gcpro gcpro1;
912
913 /* Read the string itself. */
914 tmp = read1 (readcharfun);
915 if (XTYPE (tmp) != Lisp_String)
916 Fsignal (Qinvalid_read_syntax, Fcons (make_string ("#", 1), Qnil));
917 GCPRO1 (tmp);
918 /* Read the intervals and their properties. */
919 while (1)
920 {
921 Lisp_Object beg, end, plist;
922
923 beg = read1 (readcharfun);
924 if (XTYPE (beg) == Lisp_Internal)
925 {
926 if (XINT (beg) == ')')
927 break;
928 Fsignal (Qinvalid_read_syntax, Fcons (make_string ("invalid string property list", 28), Qnil));
929 }
930 end = read1 (readcharfun);
931 if (XTYPE (end) == Lisp_Internal)
932 Fsignal (Qinvalid_read_syntax,
933 Fcons (make_string ("invalid string property list", 28), Qnil));
934
935 plist = read1 (readcharfun);
936 if (XTYPE (plist) == Lisp_Internal)
937 Fsignal (Qinvalid_read_syntax,
938 Fcons (make_string ("invalid string property list", 28), Qnil));
939 Fset_text_properties (beg, end, plist, tmp);
940 }
941 UNGCPRO;
942 return tmp;
943 }
944#endif
905 UNREAD (c); 945 UNREAD (c);
906 return Fsignal (Qinvalid_read_syntax, Fcons (make_string ("#", 1), Qnil)); 946 Fsignal (Qinvalid_read_syntax, Fcons (make_string ("#", 1), Qnil));
907 947
908 case ';': 948 case ';':
909 while ((c = READCHAR) >= 0 && c != '\n'); 949 while ((c = READCHAR) >= 0 && c != '\n');