aboutsummaryrefslogtreecommitdiff
path: root/build/lexer.cxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2015-09-09 15:56:54 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2015-09-09 15:56:54 +0200
commitea66709a853255c7957a8a7907fd21fa7f6cfd3f (patch)
tree061f828174b4a1d9d5c5fbc0b3b7427b5eea1ee8 /build/lexer.cxx
parent8a9870ed59225972de389b7b4a494a57390bff1b (diff)
Add support for quoting directive names
Now only unquoted, literal names are recognized as directives, for example: 'print' = abc print $print
Diffstat (limited to 'build/lexer.cxx')
-rw-r--r--build/lexer.cxx7
1 files changed, 6 insertions, 1 deletions
diff --git a/build/lexer.cxx b/build/lexer.cxx
index 133375b..e083b4a 100644
--- a/build/lexer.cxx
+++ b/build/lexer.cxx
@@ -152,6 +152,7 @@ namespace build
string lexeme;
lexer_mode m (mode_.top ());
+ bool quoted (m == lexer_mode::quoted);
for (; !eos (c); c = peek ())
{
@@ -247,6 +248,7 @@ namespace build
if (eos (c))
fail (c) << "unterminated single-quoted sequence";
+ quoted = true;
continue;
}
}
@@ -281,7 +283,10 @@ namespace build
if (m == lexer_mode::quoted)
mode_.pop ();
else
+ {
mode_.push (lexer_mode::quoted);
+ quoted = true;
+ }
m = mode_.top ();
continue;
@@ -307,7 +312,7 @@ namespace build
if (m == lexer_mode::variable)
mode_.pop ();
- return token (lexeme, sep, ln, cn);
+ return token (lexeme, sep, quoted, ln, cn);
}
bool lexer::