From 5c186f901ea7d1b09ab551a3fd2a6c1fd2426d59 Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Tue, 20 Jun 2017 20:33:52 +0300 Subject: Add support for build configuration warning-detecting regexes --- libbbot/build-config.cxx | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) (limited to 'libbbot/build-config.cxx') diff --git a/libbbot/build-config.cxx b/libbbot/build-config.cxx index 071ad7f..f18c48a 100644 --- a/libbbot/build-config.cxx +++ b/libbbot/build-config.cxx @@ -75,14 +75,15 @@ namespace bbot continue; } - // If the third field doesn't contain '=' character, then we will treat - // it as a target. + // If the third field doesn't start with '~' character and doesn't + // contain '=' character, then we will treat it as a target. // - if (tl[i].value.find ('=') == string::npos) + const string& v (tl[i].value); + if (v[0] != '~' && v.find ('=') == string::npos) { try { - config.target = target_triplet (tl[i].value); + config.target = target_triplet (v); } catch (const invalid_argument& e) { @@ -96,8 +97,19 @@ namespace bbot { for (; i < n; ++i) { - task_manifest::check_config (tl[i].value); - config.vars.emplace_back (move (tl[i].value)); + string& v (tl[i].value); + + if (v[0] == '~') // Regular expression. + { + string re (v, 1); + task_manifest::check_regex (re); + config.warning_regexes.emplace_back (move (re)); + } + else // Configuration variable. + { + task_manifest::check_config (v); + config.vars.emplace_back (move (v)); + } } } catch (const invalid_argument& e) -- cgit v1.1