diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2020-05-18 14:50:56 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2020-05-27 08:35:29 +0200 |
commit | 5910fbb854d7aa957091aa48a248b2de239eb558 (patch) | |
tree | 0989873ff8375ffadc07923468e86c3465dae922 /libbuild2/parser.cxx | |
parent | 80a9e7a52db8d686ba81beb5399c80b300ce4a96 (diff) |
Integrate buildscript pre-parsing into recipe parsing
Diffstat (limited to 'libbuild2/parser.cxx')
-rw-r--r-- | libbuild2/parser.cxx | 15 |
1 files changed, 11 insertions, 4 deletions
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 <libbuild2/diagnostics.hxx> #include <libbuild2/prerequisite.hxx> +#include <libbuild2/build/script/parser.hxx> +#include <libbuild2/build/script/script.hxx> + #include <libbuild2/config/utility.hxx> // 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<adhoc_rule> 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 ())); |