diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2011-09-26 21:39:44 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2011-09-26 21:45:45 -0700 |
commit | 7185545a38de4f53bf3c92be5d1d97d2928ffbb9 (patch) | |
tree | fcc1a4a6f69cf716e9212802a777068444756411 | |
parent | 070d3dfe7759943406cd76e7aebe72bf92ab3503 (diff) | |
download | txr-7185545a38de4f53bf3c92be5d1d97d2928ffbb9.tar.gz txr-7185545a38de4f53bf3c92be5d1d97d2928ffbb9.tar.bz2 txr-7185545a38de4f53bf3c92be5d1d97d2928ffbb9.zip |
Bugfixes: Consistent escaping in various literals. Double
backslash codes for single backslash. Output clause can be empty.
* parser.l (char_esc): Backslash handled.
Use internal_error rather than abort.
(REGCHAR, LITCHAR): Backslash added to lexical syntax.
* parser.y (output_clause): Allow empty output clause.
-rw-r--r-- | ChangeLog | 11 | ||||
-rw-r--r-- | parser.l | 16 | ||||
-rw-r--r-- | parser.y | 2 |
3 files changed, 23 insertions, 6 deletions
@@ -1,5 +1,16 @@ 2011-09-26 Kaz Kylheku <kaz@kylheku.com> + Bugfixes: Consistent escaping in various literals. Double + backslash codes for single backslash. Output clause can be empty. + + * parser.l (char_esc): Backslash handled. + Use internal_error rather than abort. + (REGCHAR, LITCHAR): Backslash added to lexical syntax. + + * parser.y (output_clause): Allow empty output clause. + +2011-09-26 Kaz Kylheku <kaz@kylheku.com> + New feature: @(deffilter) Bugfix in @(throw) when non-symbol is thrown: exception message @@ -34,12 +34,14 @@ #include <errno.h> #include <dirent.h> #include <wchar.h> +#include <setjmp.h> #include "config.h" #include "lib.h" #include "y.tab.h" #include "gc.h" #include "stream.h" #include "utf8.h" +#include "unwind.h" #include "parser.h" #define YY_INPUT(buf, result, max_size) \ @@ -145,9 +147,11 @@ static wchar_t char_esc(int letter) case '"': return L'"'; case '\'': return L'\''; case '`': return L'`'; + case '/': return L'/'; + case '\\': return L'\\'; } - abort(); + internal_error("unhandled escape character"); } static wchar_t num_esc(char *num) @@ -425,10 +429,10 @@ UONLY {U2}{U}|{U3}{U}{U}|{U4}{U}{U}{U} } -<REGEX>[\\][abtnvfre] { - yylval.chr = char_esc(yytext[1]); - return REGCHAR; - } +<REGEX>[\\][abtnvfre\\] { + yylval.chr = char_esc(yytext[1]); + return REGCHAR; + } <REGEX>[\\](x{HEX}+|{OCT}+) { yylval.chr = num_esc(yytext + 1); @@ -516,7 +520,7 @@ UONLY {U2}{U}|{U3}{U}{U}|{U4}{U}{U}{U} return yytext[0]; } -<STRLIT,CHRLIT,QSILIT>[\\][abtnvfre"`'] { +<STRLIT,CHRLIT,QSILIT>[\\][abtnvfre"`'\\] { yylval.chr = char_esc(yytext[1]); return LITCHAR; } @@ -271,6 +271,8 @@ output_clause : OUTPUT ')' o_elems '\n' END newl { $$ = nil; yyerror("obsolete output syntax: trailing material"); } | OUTPUT ')' newl + END newl { $$ = list(output_s, nao); } + | OUTPUT ')' newl out_clauses END newl { $$ = list(output_s, $4, nao); } | OUTPUT exprs ')' newl |