From fbabb3ddf7f9bee71a6be767cc911b5b3b96333a Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Fri, 7 Dec 2018 21:38:00 +0300 Subject: Add support for build configuration class inheritance --- tests/build-class-expr/driver.cxx | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) (limited to 'tests/build-class-expr/driver.cxx') diff --git a/tests/build-class-expr/driver.cxx b/tests/build-class-expr/driver.cxx index 343c3b5..586d459 100644 --- a/tests/build-class-expr/driver.cxx +++ b/tests/build-class-expr/driver.cxx @@ -14,7 +14,7 @@ // Usages: // // argv[0] -p -// argv[0] [] +// argv[0] [[:]]* // // Parse stdin lines as build configuration class expressions and print them // or evaluate. @@ -47,13 +47,28 @@ main (int argc, char* argv[]) cin.exceptions (ios::badbit); strings cs; + build_class_inheritance_map im; if (print) cout.exceptions (ios::failbit | ios::badbit); else { for (int i (1); i != argc; ++i) - cs.push_back (argv[i]); + { + string c (argv[i]); + + string base; + size_t p (c.find (':')); + + if (p != string::npos) + { + base = string (c, p + 1); + c.resize (p); + } + + im[c] = move (base); + cs.emplace_back (move (c)); + } } try @@ -77,18 +92,18 @@ main (int argc, char* argv[]) if (!underlying_cls->empty ()) { build_class_expr expr (*underlying_cls, '+', "" /* comment */); - expr.match (cs, r); + expr.match (cs, im, r); } } - expr.match (cs, r); + expr.match (cs, im, r); } } if (underlying_cls && !underlying_cls->empty ()) { build_class_expr expr (*underlying_cls, '&', "" /* comment */); - expr.match (cs, r); + expr.match (cs, im, r); } return print || r ? 0 : 1; -- cgit v1.1