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/parser.hxx | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'libbuild2/parser.hxx') diff --git a/libbuild2/parser.hxx b/libbuild2/parser.hxx index bc01e08..2f67c31 100644 --- a/libbuild2/parser.hxx +++ b/libbuild2/parser.hxx @@ -619,7 +619,14 @@ namespace build2 enable_attributes () { if (replay_ != replay::play) - lexer_->enable_attributes (); + lexer_->enable_lsbrace (); + } + + void + enable_subscript () + { + if (replay_ != replay::play) + lexer_->enable_lsbrace (true /* unseparated */); } void -- cgit v1.1