aboutsummaryrefslogtreecommitdiff
path: root/libbuild2/parser.hxx
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2022-10-20 19:39:57 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2022-10-21 11:50:52 +0300
commit4881a227779a78db1de2a7723e2a86f2b61453b3 (patch)
treec85ca613cc1a9dc4952d0cc7b0c55603f2b4edfa /libbuild2/parser.hxx
parente5efed8e25180b9d009edf2a06e5151db107e883 (diff)
Change attribute syntax in script to come after variable in set and for (set x [...], for x [...])
Diffstat (limited to 'libbuild2/parser.hxx')
-rw-r--r--libbuild2/parser.hxx20
1 files changed, 15 insertions, 5 deletions
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<bool, location>
- attributes_push (token&, token_type&, bool standalone = false);
+ attributes_push (token&, token_type&,
+ bool standalone = false,
+ bool next_token = true);
attributes
attributes_pop ()