From 5910fbb854d7aa957091aa48a248b2de239eb558 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Mon, 18 May 2020 14:50:56 +0200 Subject: Integrate buildscript pre-parsing into recipe parsing --- libbuild2/parser.cxx | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'libbuild2/parser.cxx') diff --git a/libbuild2/parser.cxx b/libbuild2/parser.cxx index 588968e..f2cdbfd 100644 --- a/libbuild2/parser.cxx +++ b/libbuild2/parser.cxx @@ -20,6 +20,9 @@ #include #include +#include +#include + #include // lookup_config using namespace std; @@ -1113,9 +1116,6 @@ namespace build2 fail (t) << "unterminated recipe block" << info (st) << "recipe block starts here" << endf; - // @@ TODO: we need to reuse the same rules for all the targets! Kill - // me now. - // shared_ptr ar; if (first) { @@ -1128,7 +1128,14 @@ namespace build2 if (!lang) { - ar.reset (new adhoc_script_rule (move (t.value), + using build::script::parser; + using build::script::script; + + parser p (ctx); + istringstream is (move (t.value)); + script s (p.pre_parse (is, path_name (loc.file), loc.line + 1)); + + ar.reset (new adhoc_script_rule (move (s), move (diag), loc, st.value.size ())); -- cgit v1.1