From 4881a227779a78db1de2a7723e2a86f2b61453b3 Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Thu, 20 Oct 2022 19:39:57 +0300 Subject: Change attribute syntax in script to come after variable in set and for (set x [...], for x [...]) --- libbuild2/parser.hxx | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) (limited to 'libbuild2/parser.hxx') diff --git a/libbuild2/parser.hxx b/libbuild2/parser.hxx index 0d7e900..b3a5395 100644 --- a/libbuild2/parser.hxx +++ b/libbuild2/parser.hxx @@ -344,15 +344,25 @@ namespace build2 // Push a new entry into the attributes_ stack. If the next token is `[` // then parse the attribute sequence until ']' storing the result in the - // new stack entry. Then get the next token and, if standalone is false, - // verify it is not newline/eos (i.e., there is something after it). - // Return the indication of whether we have seen any attributes (note - // that the `[]` empty list does not count) and the location of `[`. + // new stack entry. Then, if next_token is true, get the next token and, + // if standalone is false, verify it is not newline/eos (i.e., there is + // something after it). If the next token is read and it is a word or a + // "word-producing" token (`$` for variable expansions/function calls, `(` + // for eval contexts, and `{` for name generation), then verify that it is + // separated to reduce the possibility of confusing it with a wildcard + // pattern. Consider: + // + // ./: [abc]-foo.txt + // + // Return the indication of whether we have seen any attributes (note that + // the `[]` empty list does not count) and the location of `[`. // // Note that during pre-parsing nothing is pushed into the stack. // pair - attributes_push (token&, token_type&, bool standalone = false); + attributes_push (token&, token_type&, + bool standalone = false, + bool next_token = true); attributes attributes_pop () -- cgit v1.1