diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2019-09-27 13:55:07 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2019-09-30 15:30:45 +0200 |
commit | 12268f7741ba73c75a73fafb6063f1393e485aae (patch) | |
tree | c80fe4918c18702f6cb199c9016366338f8f5061 /libbuild2/parser.hxx | |
parent | e59c2bc979293d8cdea3f9733ecd59c080fce63c (diff) |
Add support for custom match/extract functions in switch expression
Diffstat (limited to 'libbuild2/parser.hxx')
-rw-r--r-- | libbuild2/parser.hxx | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/libbuild2/parser.hxx b/libbuild2/parser.hxx index e199a9a..581ad1b 100644 --- a/libbuild2/parser.hxx +++ b/libbuild2/parser.hxx @@ -254,11 +254,6 @@ namespace build2 bool enter, bool default_target); - // If chunk is true, then parse the smallest but complete, name-wise, - // chunk of input. Note that in this case you may still end up with - // multiple names, for example, {foo bar} or $foo. In the pre-parse mode - // always return empty list of names. - // // The what argument is used in diagnostics (e.g., "expected <what> // instead of ...". // @@ -273,7 +268,21 @@ namespace build2 names parse_names (token& t, token_type& tt, pattern_mode pmode, - bool chunk = false, + const char* what = "name", + const string* separators = &name_separators) + { + return parse_names (t, tt, pmode, false /* chunk */, what, separators); + } + + // If chunk is true, then parse the smallest but complete, name-wise, + // chunk of input. Note that in this case you may still end up with + // multiple names, for example, {foo bar} or $foo. In the pre-parse mode + // always return empty list of names. + // + names + parse_names (token& t, token_type& tt, + pattern_mode pmode, + bool chunk, const char* what = "name", const string* separators = &name_separators) { |