aboutsummaryrefslogtreecommitdiff
path: root/build2/test/script/script.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'build2/test/script/script.cxx')
-rw-r--r--build2/test/script/script.cxx22
1 files changed, 20 insertions, 2 deletions
diff --git a/build2/test/script/script.cxx b/build2/test/script/script.cxx
index 7d1d8cf..b128077 100644
--- a/build2/test/script/script.cxx
+++ b/build2/test/script/script.cxx
@@ -17,8 +17,26 @@ namespace build2
{
namespace script
{
- // Utility functions
- //
+ ostream&
+ operator<< (ostream& o, line_type lt)
+ {
+ const char* s (nullptr);
+
+ switch (lt)
+ {
+ case line_type::var: s = "variable"; break;
+ case line_type::cmd: s = "command"; break;
+ case line_type::cmd_if: s = "'if'"; break;
+ case line_type::cmd_ifn: s = "'if!'"; break;
+ case line_type::cmd_elif: s = "'elif'"; break;
+ case line_type::cmd_elifn: s = "'elif!'"; break;
+ case line_type::cmd_else: s = "'else'"; break;
+ case line_type::cmd_end: s = "'end'"; break;
+ }
+
+ return o << s;
+ }
+
// Quote if empty or contains spaces or any of the special characters.
//
// @@ What if it contains quotes, escapes?