diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2015-07-23 07:47:11 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2015-07-23 07:47:11 -0700 |
commit | 292d6a1f11174da58fad1106b4aa5f8baea585f2 (patch) | |
tree | f45e40329c77d881e18e2a787e19ba23769912ce /parser.l | |
parent | 750649f31e4ad1ae40bfee4a62909f3f1496010b (diff) | |
download | txr-292d6a1f11174da58fad1106b4aa5f8baea585f2.tar.gz txr-292d6a1f11174da58fad1106b4aa5f8baea585f2.tar.bz2 txr-292d6a1f11174da58fad1106b4aa5f8baea585f2.zip |
* parser.l (grammar): Do not allow unescaped newline in
word list literals and word list quasiliterals, except
in <= 109 compatibility mode. An escaped newline in
these literals, together with surrounding whitespace,
now produces a single space, except in <= 109
compatibility mode.
* txr.1: Documented new rules for WLL's and QLL's,
and added compatibility notes.
Diffstat (limited to 'parser.l')
-rw-r--r-- | parser.l | 16 |
1 files changed, 15 insertions, 1 deletions
@@ -854,10 +854,18 @@ UONLY {U2}{U}|{U3}{U}{U}|{U4}{U}{U}{U} return LITCHAR; } +<STRLIT,QSILIT>{WS}[\\]\n{WS} { + yyextra->lineno++; +} + <STRLIT,QSILIT,WLIT,QWLIT>{WS}[\\]\n{WS} { yyextra->lineno++; + + if (!opt_compat || opt_compat > 109) + return ' '; } + <STRLIT,QSILIT,WLIT,QWLIT>[\\](x{HEX}+|{OCT}+);? { yylval->chr = num_esc(yyg, yytext+1); return LITCHAR; @@ -905,7 +913,13 @@ UONLY {U2}{U}|{U3}{U}{U}|{U4}{U}{U}{U} <WLIT,QWLIT>\n { yyextra->lineno++; - return ' '; + + if (opt_compat && opt_compat <= 109) + return ' '; + + yyerrprepf(yyg, lit("newline in word list literal"), nao); + yylval->chr = yytext[0]; + return ERRTOK; } <QSILIT,QWLIT>@/([[({'^,@]|{TOK}) { |