diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2021-10-14 11:56:35 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2021-10-14 11:57:28 +0200 |
commit | cbea7fec9a493e543ebc6284d17041c9e91cb28f (patch) | |
tree | 8179ca177ffb36ecdee18a02b207620fc4d7c2c1 /libbuild2/script | |
parent | 3a2969cf54fb21273b7949095c709f6aa9a2a6d9 (diff) |
Disable re-parse of sole expansions in Buildscript
Diffstat (limited to 'libbuild2/script')
-rw-r--r-- | libbuild2/script/parser.cxx | 21 | ||||
-rw-r--r-- | libbuild2/script/parser.hxx | 3 |
2 files changed, 16 insertions, 8 deletions
diff --git a/libbuild2/script/parser.cxx b/libbuild2/script/parser.cxx index b0431a9..fffe7bb 100644 --- a/libbuild2/script/parser.cxx +++ b/libbuild2/script/parser.cxx @@ -1084,17 +1084,24 @@ namespace build2 "command line", nullptr); - // Nothing else to do if we are pre-parsing. + // Nothing else to do if we are pre-parsing (or if parse_program() + // took care of this chunk). // - if (pre_parse_) + if (pre_parse_ || ns.empty ()) break; - // Process what we got. Determine whether anything inside was - // quoted (note that the current token is "next" and is not part - // of this). + // Process what we got. + // + // First see if this is a value that should not be re-lexed. The + // long term plan is to only re-lex values of a special type + // representing a canned command line. + // + // Otherwise, determine whether anything inside was quoted (note + // that the current token is "next" and is not part of this). // - bool q ((quoted () - - (t.qtype != quote_type::unquoted ? 1 : 0)) != 0); + bool q ( + (pr.value && !relex_) || + (quoted () - (t.qtype != quote_type::unquoted ? 1 : 0)) != 0); for (name& n: ns) { diff --git a/libbuild2/script/parser.hxx b/libbuild2/script/parser.hxx index 077cb22..6e24d37 100644 --- a/libbuild2/script/parser.hxx +++ b/libbuild2/script/parser.hxx @@ -25,7 +25,7 @@ namespace build2 class parser: protected build2::parser { public: - parser (context& c): build2::parser (c) {} + parser (context& c, bool relex): build2::parser (c), relex_ (relex) {} // Helpers. // @@ -229,6 +229,7 @@ namespace build2 size_t replay_quoted_; protected: + bool relex_; lexer* lexer_ = nullptr; }; } |