From 12268f7741ba73c75a73fafb6063f1393e485aae Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Fri, 27 Sep 2019 13:55:07 +0200 Subject: Add support for custom match/extract functions in switch expression --- libbuild2/parser.hxx | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) (limited to 'libbuild2/parser.hxx') 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 // 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) { -- cgit v1.1