aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2020-06-17 21:58:35 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2020-06-18 13:12:15 +0300
commit448747903956f70f85f5135a224bbbae7f7b276a (patch)
tree5a8f3b98fa40cb97db772670a2ddacaff8eea760
parentd3b8f6b067ca1d04d54ddb8469c52821ead7cb41 (diff)
Fix build2::script::parser::[reset_]quoted() to consider peeked token in replay mode
-rw-r--r--libbuild2/script/parser.cxx5
1 files changed, 3 insertions, 2 deletions
diff --git a/libbuild2/script/parser.cxx b/libbuild2/script/parser.cxx
index fd9399d..a00651c 100644
--- a/libbuild2/script/parser.cxx
+++ b/libbuild2/script/parser.cxx
@@ -1713,7 +1713,8 @@ namespace build2
{
// Examine tokens we have replayed since last reset.
//
- for (size_t i (replay_quoted_); i != replay_i_; ++i)
+ size_t ri (!peeked_ ? replay_i_ : replay_i_ - 1);
+ for (size_t i (replay_quoted_); i != ri; ++i)
if (replay_data_[i].token.qtype != quote_type::unquoted)
++r;
}
@@ -1728,7 +1729,7 @@ namespace build2
lexer_->reset_quoted (cur.qtype != quote_type::unquoted ? 1 : 0);
else
{
- replay_quoted_ = replay_i_ - 1;
+ replay_quoted_ = replay_i_ - (!peeked_ ? 1 : 2);
// Must be the same token.
//