From ece4003beebd23082a5fd7a324de40c5572161d1 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Thu, 16 Mar 2017 10:35:32 +0200 Subject: Add support for passing parameters to (meta-) operations --- unit-tests/lexer/buildfile | 2 +- unit-tests/lexer/buildspec.test | 16 ++++++++++++++++ unit-tests/lexer/driver.cxx | 4 ++++ 3 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 unit-tests/lexer/buildspec.test (limited to 'unit-tests') diff --git a/unit-tests/lexer/buildfile b/unit-tests/lexer/buildfile index 520d17c..47c9e45 100644 --- a/unit-tests/lexer/buildfile +++ b/unit-tests/lexer/buildfile @@ -12,6 +12,6 @@ functions-target-triplet algorithm search dump filesystem scheduler \ config/{utility init operation} exe{driver}: cxx{driver} ../../build2/cxx{$src} ../../build2/liba{b} $libs \ -test{comment eval quoting} +test{*} include ../../build2/ diff --git a/unit-tests/lexer/buildspec.test b/unit-tests/lexer/buildspec.test new file mode 100644 index 0000000..81eeb00 --- /dev/null +++ b/unit-tests/lexer/buildspec.test @@ -0,0 +1,16 @@ +# file : unit-tests/lexer/buildspec.test +# copyright : Copyright (c) 2014-2017 Code Synthesis Ltd +# license : MIT; see accompanying LICENSE file + +test.arguments = buildspec + +: punctuation +: +$* <:'x,x(x)' >>EOO +'x' +, +'x' + ( +'x' +) +EOO diff --git a/unit-tests/lexer/driver.cxx b/unit-tests/lexer/driver.cxx index e9ccd63..41366ec 100644 --- a/unit-tests/lexer/driver.cxx +++ b/unit-tests/lexer/driver.cxx @@ -36,6 +36,7 @@ namespace build2 else if (a == "value") m = lexer_mode::value; else if (a == "attribute") m = lexer_mode::attribute; else if (a == "eval") m = lexer_mode::eval; + else if (a == "buildspec") m = lexer_mode::buildspec; else assert (false); break; } @@ -56,6 +57,9 @@ namespace build2 // for (token t (l.next ()); t.type != token_type::eos; t = l.next ()) { + if (t.separated && t.type != token_type::newline) + cout << ' '; + // Print each token on a separate line without quoting operators. // t.printer (cout, t, false); -- cgit v1.1