]> granicus.if.org Git - flex/commitdiff
Fix escaping of `[[` and `]]` in strings
authorDemi Obenour <demiobenour@gmail.com>
Sun, 4 Sep 2016 22:27:36 +0000 (18:27 -0400)
committerDemi Obenour <demiobenour@gmail.com>
Sun, 4 Sep 2016 22:29:30 +0000 (18:29 -0400)
Previously, `[[` and `]]` were not escaped in strings, which led
to bad interactions with m4.

Also, don't break strings on newline, as GCC et al support whitespace
between a backslash and the subsequent newline.

src/scan.l

index 6c1985bef1d460da8c949b2c1a74f9c71d5e1d87..f8b70581dff66f9985d75f9022b40b5dc76d403b 100644 (file)
@@ -939,7 +939,9 @@ nmstr[yyleng - 2 - end_is_ws] = '\0';  /* chop trailing brace */
 <ACTION_STRING>{
        [^"\\\n]+       ACTION_ECHO;
        \\.             ACTION_ECHO;
-       {NL}            ++linenum; ACTION_ECHO; BEGIN(ACTION);
+        {M4QEND}        ACTION_ECHO_QEND;
+        {M4QSTART}      ACTION_ECHO_QSTART;
+       {NL}            ++linenum; ACTION_ECHO;
        \"              ACTION_ECHO; BEGIN(ACTION);
        .               ACTION_ECHO;
 }