From 7528bc0aee69c32fad8ffd8c84a4008627b7e445 Mon Sep 17 00:00:00 2001 From: Demi Obenour Date: Sun, 4 Sep 2016 18:27:36 -0400 Subject: Fix escaping of `[[` and `]]` in strings 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 | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/scan.l b/src/scan.l index 6c1985b..f8b7058 100644 --- a/src/scan.l +++ b/src/scan.l @@ -939,7 +939,9 @@ nmstr[yyleng - 2 - end_is_ws] = '\0'; /* chop trailing brace */ { [^"\\\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; } -- cgit v1.2.3