aboutsummaryrefslogtreecommitdiff
path: root/libbuild2/build/script/parser.test.cxx
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2020-05-18 12:06:16 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2020-05-18 12:06:16 +0300
commitdfb1415d5eaf006ee45235f275d17f52d3db38e5 (patch)
treebc617819ce3ecee2687252b82c9fb664d76b630b /libbuild2/build/script/parser.test.cxx
parent96908ec43ed27d9f34da27b6a94a6db357465056 (diff)
Add dump(ostream,script::lines) (partial implementation)build-script
Diffstat (limited to 'libbuild2/build/script/parser.test.cxx')
-rw-r--r--libbuild2/build/script/parser.test.cxx21
1 files changed, 17 insertions, 4 deletions
diff --git a/libbuild2/build/script/parser.test.cxx b/libbuild2/build/script/parser.test.cxx
index 2763464..77f6596 100644
--- a/libbuild2/build/script/parser.test.cxx
+++ b/libbuild2/build/script/parser.test.cxx
@@ -67,7 +67,10 @@ namespace build2
bool line_;
};
- // Usage: argv[0] [-l]
+ // Usages:
+ //
+ // argv[0] [-l]
+ // argv[0] -d
//
int
main (int argc, char* argv[])
@@ -86,6 +89,7 @@ namespace build2
context ctx (sched, mutexes);
bool line (false);
+ bool dump (false);
for (int i (1); i != argc; ++i)
{
@@ -93,10 +97,14 @@ namespace build2
if (a == "-l")
line = true;
+ else if (a == "-d")
+ dump = true;
else
assert (false);
}
+ assert (!dump || !line);
+
try
{
cin.exceptions (istream::failbit | istream::badbit);
@@ -123,9 +131,14 @@ namespace build2
parser p (ctx);
p.pre_parse (cin, nm, 11 /* line */, s);
- environment e (s, tt);
- print_runner r (line);
- p.execute (e, r);
+ if (!dump)
+ {
+ environment e (s, tt);
+ print_runner r (line);
+ p.execute (e, r);
+ }
+ else
+ build2::script::dump (cout, "", s.lines);
}
catch (const failed&)
{