From 5ec57d68a5205173a02c34a24d7129347d43196c Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Thu, 14 Nov 2019 12:55:54 +0200 Subject: 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 --- libbuild2/parser.hxx | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'libbuild2/parser.hxx') diff --git a/libbuild2/parser.hxx b/libbuild2/parser.hxx index d82496d..b07936c 100644 --- a/libbuild2/parser.hxx +++ b/libbuild2/parser.hxx @@ -535,8 +535,8 @@ namespace build2 lexer_->mode (m, ps); else // As a sanity check, make sure the mode matches the next token. Note - // that we don't check the pair separator since it can be overriden by - // the lexer's mode() implementation. + // that we don't check the attributes flags or the pair separator + // since they can be overridden by the lexer's mode() implementation. // assert (replay_i_ != replay_data_.size () && replay_data_[replay_i_].mode == m); @@ -555,6 +555,13 @@ namespace build2 } void + enable_attributes () + { + if (replay_ != replay::play) + lexer_->enable_attributes (); + } + + void expire_mode () { if (replay_ != replay::play) -- cgit v1.1