diff options
Diffstat (limited to 'libbuild2')
-rw-r--r-- | libbuild2/context.cxx | 7 | ||||
-rw-r--r-- | libbuild2/lexer.cxx | 6 | ||||
-rw-r--r-- | libbuild2/parser.cxx | 7 |
3 files changed, 11 insertions, 9 deletions
diff --git a/libbuild2/context.cxx b/libbuild2/context.cxx index c9f4340..08c4e7e 100644 --- a/libbuild2/context.cxx +++ b/libbuild2/context.cxx @@ -378,12 +378,13 @@ namespace build2 istringstream is (s); is.exceptions (istringstream::failbit | istringstream::badbit); - // Similar to buildspec we do "effective escaping" and only for ['"\$(] - // (basically what's necessary inside a double-quoted literal plus the + // Similar to buildspec we do "effective escaping" of the special + // `'"\$(` characters, line continuations, plus `)` for symmetry + // (basically what's escapable inside a double-quoted literal plus the // single quote). // path_name in ("<cmdline>"); - lexer l (is, in, 1 /* line */, "\'\"\\$("); + lexer l (is, in, 1 /* line */, "\'\"\\$()\n"); // At the buildfile level the scope-specific variable should be // separated from the directory with a whitespace, for example: diff --git a/libbuild2/lexer.cxx b/libbuild2/lexer.cxx index d82c135..04c15be 100644 --- a/libbuild2/lexer.cxx +++ b/libbuild2/lexer.cxx @@ -923,10 +923,10 @@ namespace build2 auto quoted_mode = [this] (lexer_mode m) { // In the double-quoted mode we only do effective escaping of the - // special `$("\` characters plus `)` for symmetry. Nothing can be - // escaped in single-quoted. + // special `$("\` characters, line continuations, plus `)` for + // symmetry. Nothing can be escaped in single-quoted. // - const char* esc (m == lexer_mode::double_quoted ? "$()\"\\" : ""); + const char* esc (m == lexer_mode::double_quoted ? "$()\"\\\n" : ""); state_.push (state { m, 0, nullopt, false, false, '\0', false, true, true, diff --git a/libbuild2/parser.cxx b/libbuild2/parser.cxx index 5128979..4350c88 100644 --- a/libbuild2/parser.cxx +++ b/libbuild2/parser.cxx @@ -8163,11 +8163,12 @@ namespace build2 buildspec parser:: parse_buildspec (istream& is, const path_name& in) { - // We do "effective escaping" and only for ['"\$(] (basically what's - // necessary inside a double-quoted literal plus the single quote). + // We do "effective escaping" of the special `'"\$(` characters, line + // continuations, plus `)` for symmetry (basically what's escapable inside + // a double-quoted literal plus the single quote). // path_ = ∈ - lexer l (is, *path_, 1 /* line */, "\'\"\\$("); + lexer l (is, *path_, 1 /* line */, "\'\"\\$()\n"); lexer_ = &l; root_ = &ctx->global_scope.rw (); |