summaryrefslogtreecommitdiffstats
path: root/parser.l
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2015-07-23 07:47:11 -0700
committerKaz Kylheku <kaz@kylheku.com>2015-07-23 07:47:11 -0700
commit292d6a1f11174da58fad1106b4aa5f8baea585f2 (patch)
treef45e40329c77d881e18e2a787e19ba23769912ce /parser.l
parent750649f31e4ad1ae40bfee4a62909f3f1496010b (diff)
downloadtxr-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.l16
1 files changed, 15 insertions, 1 deletions
diff --git a/parser.l b/parser.l
index 29a45ab1..b1fb63fe 100644
--- a/parser.l
+++ b/parser.l
@@ -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}) {