From 773fbb10eb59c4e855eccf9966a6ef3a68e3e0c3 Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Thu, 20 Apr 2017 22:01:57 +0300 Subject: Get rid of variable struct --- bbot/build-config.cxx | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'bbot/build-config.cxx') diff --git a/bbot/build-config.cxx b/bbot/build-config.cxx index 226ead3..0ee00e9 100644 --- a/bbot/build-config.cxx +++ b/bbot/build-config.cxx @@ -13,6 +13,8 @@ #include #include +#include // task_manifest::check_config() + using namespace std; using namespace butl; @@ -34,17 +36,17 @@ namespace bbot // then we refer to the end-of-line column (presumably reporting a missed // field). // - auto bad_line = [&name, &tl, &i, n] (const string& d, size_t offset = 0) + auto bad_line = [&name, &tl, &i, n] (const string& d) { // Offset beyond the end-of-line is meaningless. // - assert (i < n || (i == n && offset == 0)); + assert (i <= n); throw tab_parsing (name, tl.line, i == n ? tl.end_column - : tl[i].column + offset, + : tl[i].column, d); }; @@ -93,12 +95,14 @@ namespace bbot try { for (; i < n; ++i) - config.vars.emplace_back (variable (move (tl[i].value))); + { + task_manifest::check_config (tl[i].value); + config.vars.emplace_back (move (tl[i].value)); + } } - catch (const invalid_variable& e) + catch (const invalid_argument& e) { - bad_line (e.what (), e.pos); // Note that tl[i].value is moved from, - // but happily we don't use it + bad_line (e.what ()); } // Save the configuration. -- cgit v1.1