aboutsummaryrefslogtreecommitdiff
path: root/build2/test/script/parser
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2016-11-04 14:50:22 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2016-11-04 14:50:22 +0200
commita7a906256f7ed26aeb94ec9c9be4df41dd839905 (patch)
tree357db7f91233b29ea076894398c8ee13b68a909d /build2/test/script/parser
parent33ca2822d5b0ee9b7dede9886104145b11d6da46 (diff)
Rework testscript parser into more modular/reusable functions
Diffstat (limited to 'build2/test/script/parser')
-rw-r--r--build2/test/script/parser33
1 files changed, 27 insertions, 6 deletions
diff --git a/build2/test/script/parser b/build2/test/script/parser
index b711676..30e39b9 100644
--- a/build2/test/script/parser
+++ b/build2/test/script/parser
@@ -58,11 +58,14 @@ namespace build2
parse_scope_body ();
description
- pre_parse_description (token&, token_type&);
+ pre_parse_leading_description (token&, token_type&);
- optional<description>
+ description
+ parse_trailing_description (token&, token_type&);
+
+ void
pre_parse_line (token&, token_type&,
- optional<description>&&,
+ optional<description>&,
lines* = nullptr);
void
@@ -71,15 +74,33 @@ namespace build2
void
perform_include (names, location);
- bool
+ value
parse_variable_line (token&, token_type&);
- pair<bool, optional<description>>
- parse_command_line (token&, token_type&, line_type, size_t);
+ // Ordered sequence of here-document redirects that we can expect to
+ // see after the command line.
+ //
+ struct here_doc
+ {
+ size_t expr; // Index in command_expr.
+ size_t pipe; // Index in command_pipe.
+ size_t redir; // Redirect (0 - in, 1 - out, 2 - err).
+
+ string end;
+ bool no_newline;
+ };
+ using here_docs = vector<here_doc>;
+
+ pair<command_expr, here_docs>
+ parse_command_line (token&, token_type&);
command_exit
parse_command_exit (token&, token_type&);
+ void
+ parse_here_documents (token&, token_type&,
+ pair<command_expr, here_docs>&);
+
string
parse_here_document (token&, token_type&, const string&, bool);