From 448747903956f70f85f5135a224bbbae7f7b276a Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Wed, 17 Jun 2020 21:58:35 +0300 Subject: Fix build2::script::parser::[reset_]quoted() to consider peeked token in replay mode --- libbuild2/script/parser.cxx | 5 +++-- 1 file 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. // -- cgit v1.1