aboutsummaryrefslogtreecommitdiff
path: root/build2
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2017-07-17 15:54:32 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2017-07-17 21:25:08 +0300
commit2d9c7b8c018f161cb22e1bccb207c46e1eac8497 (patch)
treeba6c40458739231b2defdc03b2331c786702fa5c /build2
parentcca12c6c6ec645172a731fc4c759e378a9132a29 (diff)
Allow independent wildcard patterns in a group
Diffstat (limited to 'build2')
-rw-r--r--build2/parser.cxx23
1 files changed, 17 insertions, 6 deletions
diff --git a/build2/parser.cxx b/build2/parser.cxx
index 86f45cd..96694c5 100644
--- a/build2/parser.cxx
+++ b/build2/parser.cxx
@@ -3159,12 +3159,23 @@ namespace build2
// Resolve the target if there is one. If we fail, then this is not
// a pattern.
//
- const target_type* tt (tp != nullptr && scope_ != nullptr
- ? scope_->find_target_type (*tp)
- : nullptr);
+ const target_type* ttp (tp != nullptr && scope_ != nullptr
+ ? scope_->find_target_type (*tp)
+ : nullptr);
- if (tp == nullptr || tt != nullptr)
+ if (tp == nullptr || ttp != nullptr)
{
+ // Reset the detect pattern mode to expand if the pattern is not
+ // followed by the inclusion/exclusion pattern/match. Note that
+ // if it is '}' (i.e., the end of the group), then it is a single
+ // pattern and the expansion is what we want.
+ //
+ char c;
+ if (pmode == pattern_mode::detect &&
+ (tt != type::word ||
+ ((c = peeked ().value[0]) != '+' && c != '-')))
+ pmode = pattern_mode::expand;
+
if (pmode == pattern_mode::expand)
{
count = expand_name_pattern (get_location (t),
@@ -3172,7 +3183,7 @@ namespace build2
ns,
what,
pairn,
- dp, tp, tt);
+ dp, tp, ttp);
continue;
}
@@ -3187,7 +3198,7 @@ namespace build2
dp = nullptr;
tp = nullptr;
pmode = pattern_mode::ignore;
- rpat = tt;
+ rpat = ttp;
// Fall through.
}