From cbea7fec9a493e543ebc6284d17041c9e91cb28f Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Thu, 14 Oct 2021 11:56:35 +0200 Subject: Disable re-parse of sole expansions in Buildscript --- .../script/parser+command-re-parse.test.testscript | 14 ++++++++++++- .../build/script/parser+expansion.test.testscript | 23 +++++++++++++++++++++- libbuild2/build/script/parser.hxx | 2 +- 3 files changed, 36 insertions(+), 3 deletions(-) (limited to 'libbuild2/build') diff --git a/libbuild2/build/script/parser+command-re-parse.test.testscript b/libbuild2/build/script/parser+command-re-parse.test.testscript index a59b49c..56e05b5 100644 --- a/libbuild2/build/script/parser+command-re-parse.test.testscript +++ b/libbuild2/build/script/parser+command-re-parse.test.testscript @@ -1,11 +1,23 @@ # file : libbuild2/build/script/parser+command-re-parse.test.testscript # license : MIT; see accompanying LICENSE file +# @@ TMP +# +#\ : double-quote : $* <>EOO -x = cmd \">-\" "'<-'" +x = [cmd_line] cmd \">-\" "'<-'" $x EOI cmd '>-' '<-' EOO +#\ + +: literal-re-parse +: +$* <>EOO +cmd >foo +EOI +cmd >foo +EOO diff --git a/libbuild2/build/script/parser+expansion.test.testscript b/libbuild2/build/script/parser+expansion.test.testscript index 9f1e774..086ec8f 100644 --- a/libbuild2/build/script/parser+expansion.test.testscript +++ b/libbuild2/build/script/parser+expansion.test.testscript @@ -24,12 +24,33 @@ EOI buildfile:12:5: info: while parsing string 'xy'a bc' EOE +# @@ TMP +# +#\ : invalid-redirect : $* <>EOE != 0 -x = "1>&a" +x = [cmd_line] "1>&a" cmd $x EOI :1:4: error: stdout merge redirect file descriptor must be 2 buildfile:12:5: info: while parsing string '1>&a' EOE +#\ + +: expansion-re-parse +: +$* <>EOO +x = +cmd $x + +x = foo +cmd >$x + +x = [string] foo +cmd >$x +EOI +cmd '' '' +cmd >foo +cmd >foo +EOO diff --git a/libbuild2/build/script/parser.hxx b/libbuild2/build/script/parser.hxx index 09a349f..b737a13 100644 --- a/libbuild2/build/script/parser.hxx +++ b/libbuild2/build/script/parser.hxx @@ -29,7 +29,7 @@ namespace build2 // Pre-parse. Issue diagnostics and throw failed in case of an error. // public: - parser (context& c): build2::script::parser (c) {} + parser (context& c): build2::script::parser (c, false /* relex */) {} // Note that the returned script object references the passed path // name. -- cgit v1.1