aboutsummaryrefslogtreecommitdiff
path: root/build2/test/script/lexer.cxx
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2016-10-25 16:47:00 +0300
committerBoris Kolpackov <boris@codesynthesis.com>2016-11-04 09:26:35 +0200
commitb61e9e2ba8e625a598427cc2990806b69d104a18 (patch)
tree2e4b492a2ec00b325f52753ffa456f6f90eb78f2 /build2/test/script/lexer.cxx
parente3ff4880273746c34d07e641110abaf38a1f1fca (diff)
Add support of file redirects to testscript parser
Diffstat (limited to 'build2/test/script/lexer.cxx')
-rw-r--r--build2/test/script/lexer.cxx25
1 files changed, 21 insertions, 4 deletions
diff --git a/build2/test/script/lexer.cxx b/build2/test/script/lexer.cxx
index 7ced2b9..e5514bd 100644
--- a/build2/test/script/lexer.cxx
+++ b/build2/test/script/lexer.cxx
@@ -264,10 +264,13 @@ namespace build2
{
p = peek ();
- if (p == ':')
+ if (p == ':' || p == '<')
{
get ();
- return make_token (type::in_doc_nn);
+
+ return make_token (p == ':'
+ ? type::in_doc_nn
+ : type::in_file);
}
else
return make_token (type::in_doc);
@@ -297,10 +300,24 @@ namespace build2
{
p = peek ();
- if (p == ':')
+ if (p == ':' || p == '>')
{
get ();
- return make_token (type::out_doc_nn);
+
+ if (p == ':')
+ return make_token (type::out_doc_nn);
+
+ // File redirect.
+ //
+ p = peek ();
+
+ if (p == '&')
+ {
+ get ();
+ return make_token (type::out_file_app);
+ }
+ else
+ return make_token (type::out_file);
}
else
return make_token (type::out_doc);