summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDemi Obenour <demiobenour@gmail.com>2016-09-04 18:27:36 -0400
committerDemi Obenour <demiobenour@gmail.com>2016-09-04 18:29:30 -0400
commit7528bc0aee69c32fad8ffd8c84a4008627b7e445 (patch)
treecd950f876490dcfaee2866a8642477ea88321818
parentb22b8fdb973e8b540dd6bac4910d5f0d3a78f717 (diff)
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.
-rw-r--r--src/scan.l4
1 files changed, 3 insertions, 1 deletions
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 */
<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;
}