aboutsummaryrefslogtreecommitdiff
path: root/build2/test/script/script
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2016-11-01 16:35:47 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2016-11-04 09:26:37 +0200
commit4a4e5ad3c50619ad7653b01b562af9794c97aa80 (patch)
tree3feef6e7889e5673f7212d2f3ff2c34ca871b7ab /build2/test/script/script
parent89f8e08550d437eedd16f6aa0cc5333a7db75bea (diff)
Implement command-pipe, command-expr in testscript parser
Diffstat (limited to 'build2/test/script/script')
-rw-r--r--build2/test/script/script48
1 files changed, 48 insertions, 0 deletions
diff --git a/build2/test/script/script b/build2/test/script/script
index 0b3a05e..9c65b96 100644
--- a/build2/test/script/script
+++ b/build2/test/script/script
@@ -26,6 +26,7 @@ namespace build2
// Pre-parse representation.
//
+
enum class line_type {variable, setup, tdown, test};
struct line
@@ -38,6 +39,9 @@ namespace build2
// Parse object model.
//
+
+ // redirect
+ //
enum class redirect_type
{
none,
@@ -85,6 +89,8 @@ namespace build2
~redirect ();
};
+ // cleanup
+ //
enum class cleanup_type
{
always, // &foo - cleanup, fail if does not exist.
@@ -115,6 +121,8 @@ namespace build2
};
using cleanups = vector<cleanup>;
+ // command_exit
+ //
enum class exit_comparison {eq, ne};
struct command_exit
@@ -142,6 +150,8 @@ namespace build2
uint8_t status;
};
+ // command
+ //
struct command
{
path program;
@@ -169,6 +179,36 @@ namespace build2
ostream&
operator<< (ostream&, const command&);
+ // command_pipe
+ //
+ using command_pipe = vector<command>;
+
+ void
+ to_stream (ostream&, const command_pipe&, command_to_stream);
+
+ ostream&
+ operator<< (ostream&, const command_pipe&);
+
+ // command_expr
+ //
+ enum class expr_operator {log_or, log_and};
+
+ struct expr_term
+ {
+ expr_operator op; // Ignored for the first term.
+ command_pipe pipe;
+ };
+
+ using command_expr = vector<expr_term>;
+
+ void
+ to_stream (ostream&, const command_expr&, command_to_stream);
+
+ ostream&
+ operator<< (ostream&, const command_expr&);
+
+ // description
+ //
struct description
{
string id;
@@ -182,6 +222,8 @@ namespace build2
}
};
+ // scope
+ //
class script;
class scope
@@ -254,6 +296,8 @@ namespace build2
location end_loc_;
};
+ // group
+ //
class group: public scope
{
public:
@@ -280,6 +324,8 @@ namespace build2
lines tdown_;
};
+ // test
+ //
class test: public scope
{
public:
@@ -293,6 +339,8 @@ namespace build2
lines tests_;
};
+ // script
+ //
class script_base // Make sure certain things are initialized early.
{
protected: