aboutsummaryrefslogtreecommitdiff
path: root/libbuild2/parser.cxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2020-05-18 14:50:56 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2020-05-27 08:35:29 +0200
commit5910fbb854d7aa957091aa48a248b2de239eb558 (patch)
tree0989873ff8375ffadc07923468e86c3465dae922 /libbuild2/parser.cxx
parent80a9e7a52db8d686ba81beb5399c80b300ce4a96 (diff)
Integrate buildscript pre-parsing into recipe parsing
Diffstat (limited to 'libbuild2/parser.cxx')
-rw-r--r--libbuild2/parser.cxx15
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 ()));