aboutsummaryrefslogtreecommitdiff
path: root/libbuild2/build/script/parser.hxx
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2020-11-20 22:07:37 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2020-12-02 17:31:04 +0300
commit0ff39fd77b3127c7a250e7f817e34dfaecbcc208 (patch)
treeedb20351f3d44558201b5668823c191a8722d3a5 /libbuild2/build/script/parser.hxx
parent41a6f8b7d3036708f36ea1b5bd5b8d4289428fe5 (diff)
Add support for buildscript depdb preamble
Diffstat (limited to 'libbuild2/build/script/parser.hxx')
-rw-r--r--libbuild2/build/script/parser.hxx41
1 files changed, 35 insertions, 6 deletions
diff --git a/libbuild2/build/script/parser.hxx b/libbuild2/build/script/parser.hxx
index 5ada8be..e96a806 100644
--- a/libbuild2/build/script/parser.hxx
+++ b/libbuild2/build/script/parser.hxx
@@ -8,6 +8,7 @@
#include <libbuild2/forward.hxx>
#include <libbuild2/utility.hxx>
+#include <libbuild2/depdb.hxx>
#include <libbuild2/diagnostics.hxx>
#include <libbuild2/script/parser.hxx>
@@ -34,7 +35,7 @@ namespace build2
// name.
//
script
- pre_parse (const target&,
+ pre_parse (const target&, const adhoc_actions& acts,
istream&, const path_name&, uint64_t line,
optional<string> diag_name, const location& diag_loc);
@@ -63,9 +64,26 @@ namespace build2
// Execute. Issue diagnostics and throw failed in case of an error.
//
public:
+
+ // By default call the runner's enter() and leave() functions that
+ // initialize/clean up the environment before/after the script
+ // execution.
+ //
+ void
+ execute_body (const scope& root, const scope& base,
+ environment&, const script&, runner&,
+ bool enter = true, bool leave = true);
+
+
+ // Note that it's the caller's responsibility to make sure that the
+ // runner's enter() function is called before the first preamble/body
+ // command execution and leave() -- after the last command.
+ //
void
- execute (const scope& root, const scope& base,
- environment&, const script&, runner&);
+ execute_depdb_preamble (const scope& root, const scope& base,
+ environment&, const script&, runner&,
+ depdb&);
+
// Parse a special builtin line into names, performing the variable
// and pattern expansions. If omit_builtin is true, then omit the
@@ -78,8 +96,18 @@ namespace build2
bool omit_builtin = true);
protected:
+ // Setup the parser for subsequent exec_*() function calls.
+ //
+ void
+ pre_exec (const scope& root, const scope& base,
+ environment&, const script*, runner*);
+
void
- exec_script ();
+ exec_lines (const lines&, const function<exec_cmd_function>&);
+
+ names
+ exec_special (token& t, build2::script::token_type& tt,
+ bool omit_builtin = true);
// Helpers.
//
@@ -112,6 +140,7 @@ namespace build2
protected:
script* script_;
+ const adhoc_actions* actions_; // Non-NULL during pre-parsing.
// Current low-verbosity script diagnostics and its weight.
//
@@ -165,8 +194,8 @@ namespace build2
//
// depdb string <arg> - Track the argument (single) change as string.
//
- optional<location> depdb_clear_; // 'depdb clear' location if any.
- lines depdb_lines_; // Note: excludes 'depdb clear'.
+ optional<location> depdb_clear_; // 'depdb clear' location if any.
+ lines depdb_preamble_; // Note: excludes 'depdb clear'.
// True during pre-parsing when the pre-parse mode is temporarily
// suspended to perform expansion.