From de3de2d1a58556cff5d8549e9befe2ec3cf2d08a Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Mon, 25 May 2020 12:12:13 +0200 Subject: Add support for value subscript after expansions Value subscript is only recognized in evaluation contexts (due to ambiguity with wildcard patterns; consider: $x[123].txt) and should be unseparated from the previous token. For example: x = ($y[1]) x = (($f ? $y : $z)[1]) x = ($identity($y)[$z]) --- libbuild2/script/lexer.cxx | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'libbuild2/script') diff --git a/libbuild2/script/lexer.cxx b/libbuild2/script/lexer.cxx index d78e999..ce409c1 100644 --- a/libbuild2/script/lexer.cxx +++ b/libbuild2/script/lexer.cxx @@ -16,8 +16,6 @@ namespace build2 void lexer:: mode (base_mode m, char ps, optional esc, uintptr_t data) { - bool a (false); // attributes - const char* s1 (nullptr); const char* s2 (nullptr); @@ -86,7 +84,8 @@ namespace build2 } assert (ps == '\0'); - state_.push (state {m, data, nullopt, a, ps, s, n, q, *esc, s1, s2}); + state_.push ( + state {m, data, nullopt, false, false, ps, s, n, q, *esc, s1, s2}); } token lexer:: -- cgit v1.1