From 6b3e75edf034ebcbd048a24c283c7bcf7b1da019 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Tue, 25 May 2021 11:19:04 +0200 Subject: Add support for regex-based target type/pattern specific variables This is in addition to the already supported path-based target type/pattern specific variables. For example: hxx{*}: x = y # path-based hxx{~/.*/}: x = y # regex-based --- libbuild2/dump.cxx | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'libbuild2/dump.cxx') diff --git a/libbuild2/dump.cxx b/libbuild2/dump.cxx index bc44b24..23d430e 100644 --- a/libbuild2/dump.cxx +++ b/libbuild2/dump.cxx @@ -147,6 +147,9 @@ namespace build2 const variable_type_map& vtm, const scope& s) { + using pattern = variable_pattern_map::pattern; + using pattern_type = variable_pattern_map::pattern_type; + for (const auto& vt: vtm) { const target_type& t (vt.first); @@ -154,7 +157,7 @@ namespace build2 for (const auto& vp: vpm) { - const string p (vp.first); + const pattern& pat (vp.first); const variable_map& vars (vp.second); os << endl @@ -163,7 +166,10 @@ namespace build2 if (t != target::static_type) os << t.name << '{'; - os << p; + if (pat.type == pattern_type::regex_pattern) + os << '~'; + + os << pat.text; if (t != target::static_type) os << '}'; -- cgit v1.1