aboutsummaryrefslogtreecommitdiff
path: root/build2
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2017-03-17 15:20:41 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2017-03-17 15:20:41 +0200
commit9f93d058c363ef61802222d8a63a75b0643c8bf0 (patch)
tree6a299df723664e280f26879fd8e2640567dc3c84 /build2
parentee64fadec760e28945808720271866a3be4935e1 (diff)
Add support for inclusion/exclusion groups in wildcard patterns
For example cxx{* -{foo bar *x}}.
Diffstat (limited to 'build2')
-rw-r--r--build2/parser.cxx15
1 files changed, 13 insertions, 2 deletions
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];