diff options
author | Karen Arutyunov <karen@codesynthesis.com> | 2016-12-17 23:28:30 +0300 |
---|---|---|
committer | Karen Arutyunov <karen@codesynthesis.com> | 2017-01-05 15:30:41 +0300 |
commit | 3ecbf5d51b13e11a93ae5757408a27c21d804c9f (patch) | |
tree | be46e3caa24574de106c2fbf1a05c43d32694e12 /build2/test/script/parser | |
parent | a63e1809afd9a837821d6e8376cb14a36e7fc26e (diff) |
Add support for regex in runner
Diffstat (limited to 'build2/test/script/parser')
-rw-r--r-- | build2/test/script/parser | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/build2/test/script/parser b/build2/test/script/parser index ee270d8..5fefe48 100644 --- a/build2/test/script/parser +++ b/build2/test/script/parser @@ -12,6 +12,7 @@ #include <build2/diagnostics> #include <build2/test/script/token> +#include <build2/test/script/regex> #include <build2/test/script/script> namespace build2 @@ -97,12 +98,20 @@ namespace build2 // struct here_doc { - size_t expr; // Index in command_expr. - size_t pipe; // Index in command_pipe. - int fd; // Redirect fd (0 - in, 1 - out, 2 - err). + size_t expr; // Index in command_expr. + size_t pipe; // Index in command_pipe. + int fd; // Redirect fd (0 - in, 1 - out, 2 - err). string end; - bool literal; // Literal (single-quote). + bool literal; // Literal (single-quote). string modifiers; + + // Regex introducer ('\0' if not a regex, so can be used as bool). + // + char regex; + + // Regex global flags. Meaningful if regex != '\0'. + // + regex::char_flags regex_flags; }; using here_docs = vector<here_doc>; @@ -115,10 +124,13 @@ namespace build2 void parse_here_documents (token&, token_type&, pair<command_expr, here_docs>&); - string + + pair<string, regex::line_regex> parse_here_document (token&, token_type&, const string&, - const string&); + const string& mode, + char regex_introducer, // '\0' if not a regex. + regex::char_flags); // Execute. Issue diagnostics and throw failed in case of an error. // |