diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2022-06-21 10:04:07 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2022-06-21 10:04:07 +0200 |
commit | bbe8cbd13c40a1309e0d7724319c5487a5df0879 (patch) | |
tree | bdd1e00d9605ec7d5d3d99f44f7eafaf7249a64c /libbuild2/parser.hxx | |
parent | 2f29c7fbe758ffb53e4de9983df8b1cc927dad05 (diff) |
Add --trace-{match,execute} options
These options can be used to understand which dependency chain causes matching
or execution of a particular target.
Diffstat (limited to 'libbuild2/parser.hxx')
-rw-r--r-- | libbuild2/parser.hxx | 26 |
1 files changed, 21 insertions, 5 deletions
diff --git a/libbuild2/parser.hxx b/libbuild2/parser.hxx index a71d671..9e9f926 100644 --- a/libbuild2/parser.hxx +++ b/libbuild2/parser.hxx @@ -48,7 +48,7 @@ namespace build2 explicit parser (context& c, stage s = stage::rest) : fail ("error", &path_), info ("info", &path_), - ctx (c), + ctx (&c), stage_ (s) {} // Pattern expansion mode. @@ -106,6 +106,25 @@ namespace build2 void reset (); + // Special, context-less mode that can only be used to parse literal + // names. + // + public: + static const string name_separators; + + explicit + parser (context* c) + : fail ("error", &path_), info ("info", &path_), + ctx (c), + stage_ (stage::rest) {} + + names + parse_names (lexer&, + const dir_path* base, + pattern_mode pmode, + const char* what = "name", + const string* separators = &name_separators); + // Ad hoc parsing results for some cases. // // Note that these are not touched by reset(). @@ -363,9 +382,6 @@ namespace build2 // project separator. Note that even if it is NULL, the result may still // contain non-simple names due to variable expansions. // - - static const string name_separators; - names parse_names (token& t, token_type& tt, pattern_mode pmode, @@ -869,7 +885,7 @@ namespace build2 // NOTE: remember to update reset() if adding anything here. // protected: - context& ctx; + context* ctx; stage stage_; bool pre_parse_ = false; |