From 2d9c7b8c018f161cb22e1bccb207c46e1eac8497 Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Mon, 17 Jul 2017 15:54:32 +0300 Subject: Allow independent wildcard patterns in a group --- build2/parser.cxx | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) (limited to 'build2') 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. } -- cgit v1.1