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/build | |
parent | 80a9e7a52db8d686ba81beb5399c80b300ce4a96 (diff) |
Integrate buildscript pre-parsing into recipe parsing
Diffstat (limited to 'libbuild2/build')
-rw-r--r-- | libbuild2/build/script/parser.cxx | 11 | ||||
-rw-r--r-- | libbuild2/build/script/parser.hxx | 4 |
2 files changed, 9 insertions, 6 deletions
diff --git a/libbuild2/build/script/parser.cxx b/libbuild2/build/script/parser.cxx index d26b155..c64bcd9 100644 --- a/libbuild2/build/script/parser.cxx +++ b/libbuild2/build/script/parser.cxx @@ -20,8 +20,8 @@ namespace build2 // Pre-parse. // - void parser:: - pre_parse (istream& is, const path_name& pn, uint64_t line, script& s) + script parser:: + pre_parse (istream& is, const path_name& pn, uint64_t line) { path_ = &pn; @@ -30,17 +30,20 @@ namespace build2 lexer l (is, *path_, line, lexer_mode::command_line); set_lexer (&l); + script s; script_ = &s; runner_ = nullptr; environment_ = nullptr; - script_->start_loc = location (*path_, line, 1); + s.start_loc = location (*path_, line, 1); token t (pre_parse_script ()); assert (t.type == type::eos); - script_->end_loc = get_location (t); + s.end_loc = get_location (t); + + return s; } token parser:: diff --git a/libbuild2/build/script/parser.hxx b/libbuild2/build/script/parser.hxx index a8ffb25..c88898b 100644 --- a/libbuild2/build/script/parser.hxx +++ b/libbuild2/build/script/parser.hxx @@ -30,8 +30,8 @@ namespace build2 public: parser (context& c): build2::script::parser (c) {} - void - pre_parse (istream&, const path_name&, uint64_t line, script&); + script + pre_parse (istream&, const path_name&, uint64_t line); // Recursive descent parser. // |