diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2019-11-14 12:55:54 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2019-11-14 13:20:08 +0200 |
commit | 5ec57d68a5205173a02c34a24d7129347d43196c (patch) | |
tree | 303de46753bcde9f9ccff094d6591b6bb7583931 /libbuild2/test/script/parser.cxx | |
parent | 62a688e3fd7d1fdb8ce5590ebe9cb99e90cbe5d7 (diff) |
Tighten up attribute recognition during parsing
Now it should be possible to use `[]` for wildcard patterns, for example:
foo = foo.[hit]xx
Note that a leading bracket expression will still be recognized as attributes
and escaping or quoting it will inhibit pattern matching. To resolve this case
we need to specify an empty attribute list:
foo = [] [abc]-foo.cxx
Diffstat (limited to 'libbuild2/test/script/parser.cxx')
-rw-r--r-- | libbuild2/test/script/parser.cxx | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/libbuild2/test/script/parser.cxx b/libbuild2/test/script/parser.cxx index f3f6ffa..aa78437 100644 --- a/libbuild2/test/script/parser.cxx +++ b/libbuild2/test/script/parser.cxx @@ -1288,10 +1288,11 @@ namespace build2 // enter: assignment // leave: newline or semi - // We cannot reuse the value mode since it will recognize { which we + // We cannot reuse the value mode since it will recognize `{` which we // want to treat as a literal. // mode (lexer_mode::variable_line); + enable_attributes (); // @@ VAL next (t, tt); // Parse value attributes if any. Note that it's ok not to have @@ -3446,11 +3447,13 @@ namespace build2 path_ = &name; istringstream is (attributes); - lexer l (is, name, lexer_mode::attribute); + lexer l (is, name, lexer_mode::attributes); set_lexer (&l); token t; type tt; + + enable_attributes (); // Enable `[` recognition. next (t, tt); if (tt != type::lsbrace && tt != type::eos) |