changeset 49765:ef3e82270e93

(read_escape): Interpret \s as a SPACE character, except for \s-X in a character constant which still is the super modifier. (read1): Signal an `invalid read syntax' error if a character constant is immediately followed by a digit or symbol character.
author Kim F. Storm <storm@cua.dk>
date Thu, 13 Feb 2003 12:44:57 +0000
parents cd49dc222af4
children d0dedef2274e
files src/ChangeLog src/lread.c
diffstat 2 files changed, 21 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/ChangeLog	Thu Feb 13 11:57:42 2003 +0000
+++ b/src/ChangeLog	Thu Feb 13 12:44:57 2003 +0000
@@ -1,5 +1,10 @@
 2003-02-13  Kim F. Storm  <storm@cua.dk>
 
+	* lread.c (read_escape): Interpret \s as a SPACE character, except
+	for \s-X in a character constant which still is the super modifier.
+	(read1): Signal an `invalid read syntax' error if a character
+	constant is immediately followed by a digit or symbol character.
+
 	* search.c (Fmatch_data): Doc fix.  Explicitly state that
 	match-data is undefined if last search failed.
 
--- a/src/lread.c	Thu Feb 13 11:57:42 2003 +0000
+++ b/src/lread.c	Thu Feb 13 12:44:57 2003 +0000
@@ -1697,9 +1697,13 @@
       return c | alt_modifier;
 
     case 's':
+      if (stringp)
+	return ' ';
       c = READCHAR;
-      if (c != '-')
-	error ("Invalid escape character syntax");
+      if (c != '-') {
+	UNREAD (c);
+	return ' ';
+      }
       c = READCHAR;
       if (c == '\\')
 	c = read_escape (readcharfun, 0, byterep);
@@ -2247,6 +2251,7 @@
     case '?':
       {
 	int discard;
+	int nextc;
 
 	c = READCHAR;
 	if (c < 0)
@@ -2257,6 +2262,15 @@
 	else if (BASE_LEADING_CODE_P (c))
 	  c = read_multibyte (c, readcharfun);
 
+	nextc = READCHAR;
+	UNREAD (nextc);
+	if (nextc > 040
+	    && !(nextc == '?' 
+		 || nextc == '\"' || nextc == '\'' || nextc == ';'
+		 || nextc == '(' || nextc == ')'
+		 || nextc == '[' || nextc == ']' || nextc == '#'))
+	  Fsignal (Qinvalid_read_syntax, Fcons (make_string ("?", 1), Qnil));
+
 	return make_number (c);
       }