diff options
Diffstat (limited to 'build2')
-rw-r--r-- | build2/parser.cxx | 15 |
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]; |