From 60c2c496357d3259c2fb29f7e2f1c3804eb5ad33 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Mon, 14 Feb 2022 11:25:04 +0200 Subject: Add parser::parse_eval() public API function --- libbuild2/parser.hxx | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) (limited to 'libbuild2/parser.hxx') diff --git a/libbuild2/parser.hxx b/libbuild2/parser.hxx index 0390e26..1474c5e 100644 --- a/libbuild2/parser.hxx +++ b/libbuild2/parser.hxx @@ -47,6 +47,16 @@ namespace build2 ctx (c), stage_ (s) {} + // Pattern expansion mode. + // + enum class pattern_mode + { + ignore, // Treat as literals. + preserve, // Preserve as name pattern. + expand, // Expand to non-pattern names. + detect // Implementation detail mode (see code for more information). + }; + // Issue diagnostics and throw failed in case of an error. // void @@ -74,12 +84,18 @@ namespace build2 parse_variable_value (lexer&, scope&, const dir_path*, const variable&); names - parse_export_stub (istream& is, const path_name& name, scope& r, scope& b) + parse_export_stub (istream& is, const path_name& name, + scope& rs, scope& bs) { - parse_buildfile (is, name, &r, b); + parse_buildfile (is, name, &rs, bs); return move (export_value); } + // Parse an evaluation context (`(...)`). + // + value + parse_eval (lexer&, scope& rs, scope& bs, pattern_mode); + // The above functions may be called again on the same parser instance // after a reset. // @@ -105,16 +121,6 @@ namespace build2 protected: using pattern_type = name::pattern_type; - // Pattern expansion mode. - // - enum class pattern_mode - { - ignore, // Treat as literals. - preserve, // Preserve as name pattern. - expand, // Expand to non-pattern names. - detect // Implementation detail mode (see code for more information). - }; - // If one is true then parse a single (logical) line (logical means it // can actually be several lines, e.g., an if-block). Return false if // nothing has been parsed (i.e., we are still on the same token). -- cgit v1.1