From 53d649dec4c98c9f08b963ed913685a83d68e7e1 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Thu, 20 Oct 2016 12:11:38 +0200 Subject: Fix testscript here-document quoting issue --- build2/test/script/lexer.cxx | 6 ++++-- build2/test/script/parser.cxx | 3 ++- 2 files changed, 6 insertions(+), 3 deletions(-) (limited to 'build2/test/script') diff --git a/build2/test/script/lexer.cxx b/build2/test/script/lexer.cxx index f75ad4a..d2657c6 100644 --- a/build2/test/script/lexer.cxx +++ b/build2/test/script/lexer.cxx @@ -20,6 +20,7 @@ namespace build2 const char* s1 (nullptr); const char* s2 (nullptr); bool s (true); + bool q (true); switch (m) { @@ -58,11 +59,12 @@ namespace build2 case lexer_mode::here_line: { // This one is like a double-quoted string except it treats - // newlines as a separator. + // newlines as a separator. We also treat quotes as literals. // s1 = "$(\n"; s2 = " "; s = false; + q = false; break; } default: @@ -74,7 +76,7 @@ namespace build2 } } - state_.push (state {m, '\0', s, s1, s2}); + state_.push (state {m, '\0', s, q, s1, s2}); } token lexer:: diff --git a/build2/test/script/parser.cxx b/build2/test/script/parser.cxx index a9a179b..f2f9b81 100644 --- a/build2/test/script/parser.cxx +++ b/build2/test/script/parser.cxx @@ -743,8 +743,9 @@ namespace build2 r += ' '; r += s; - r += '\n'; // Here-document line always includes a newline. } + + r += '\n'; // Here-document line always includes a newline. } // We should expand the whole line at once so this would normally be -- cgit v1.1