From 9f93d058c363ef61802222d8a63a75b0643c8bf0 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Fri, 17 Mar 2017 15:20:41 +0200 Subject: Add support for inclusion/exclusion groups in wildcard patterns For example cxx{* -{foo bar *x}}. --- build2/parser.cxx | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'build2') diff --git a/build2/parser.cxx b/build2/parser.cxx index 4d628b0..eacece1 100644 --- a/build2/parser.cxx +++ b/build2/parser.cxx @@ -2503,6 +2503,18 @@ namespace build2 name& n (*i); bool first (i == b); + char s ('\0'); // Inclusion/exclusion sign (+/-). + + // Reduce inclusions/exclusions group (-/+{foo bar}) to simple name/dir. + // + if (!first && n.typed () && n.type.size () == 1) + { + s = n.type[0]; + + if (s == '-' || s == '+') + n.type.clear (); + } + if (n.empty () || !(n.simple () || n.directory ())) fail (l) << "invalid '" << n << "' in " << what << " pattern"; @@ -2510,10 +2522,9 @@ namespace build2 // Figure out if this is inclusion or exclusion. // - char s; // +/- if (first) s = '+'; // Treat as inclusion. - else + else if (s == '\0') { s = v[0]; -- cgit v1.1