core: Fix quasisyntax reading.

* mes.c (readword): Avoid unspecified behaviour in comma list.
This commit is contained in:
Jan Nieuwenhuizen 2016-10-30 23:30:22 +01:00
parent d2768796dc
commit f1ae9edd0d

10
mes.c
View file

@ -972,12 +972,10 @@ readword (int c, scm *w, scm *a)
&scm_nil));} &scm_nil));}
return cons (lookup (symbol_unsyntax.string, a), cons (readword (getchar (), w, a), &scm_nil)); return cons (lookup (symbol_unsyntax.string, a), cons (readword (getchar (), w, a), &scm_nil));
} }
if (c == '#' if (c == '#' && (peekchar () == '\'' || peekchar () == '`') && w == &scm_nil) {
&& (peekchar () == '\'' c = getchar ();
|| peekchar () == '`') return cons (lookup (cons (make_char ('#'), cons (make_char (c), &scm_nil)), a),
&& w == &scm_nil) {return cons (lookup (cons (make_char ('#'), cons (make_char (getchar ()), &scm_nil)), a), cons (readword (getchar (), w, a), &scm_nil));}
cons (readword (getchar (), w, a),
&scm_nil));}
if (c == ';') {readcomment (c); return readword ('\n', w, a);} if (c == ';') {readcomment (c); return readword ('\n', w, a);}
if (c == '#' && peekchar () == 'x') {getchar (); return read_hex ();} if (c == '#' && peekchar () == 'x') {getchar (); return read_hex ();}
if (c == '#' && peekchar () == '\\') {getchar (); return read_character ();} if (c == '#' && peekchar () == '\\') {getchar (); return read_character ();}