aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--build2/lexer.cxx25
1 files changed, 17 insertions, 8 deletions
diff --git a/build2/lexer.cxx b/build2/lexer.cxx
index c73017e..1b24a61 100644
--- a/build2/lexer.cxx
+++ b/build2/lexer.cxx
@@ -234,10 +234,16 @@ namespace build2
//
if (m == lexer_mode::variable)
{
+ //@@ Maybe we should rather test for allowed characeters (e.g.,
+ // alnum plus '_' and '.')?
+ //
switch (c)
{
case '/':
case '-':
+ case '"':
+ case '\'':
+ case '\\':
{
done = true;
break;
@@ -268,6 +274,17 @@ namespace build2
break;
}
+ // Handle escape sequences.
+ //
+ if (c == '\\')
+ {
+ get ();
+ c = escape ();
+ if (c != '\n') // Ignore.
+ lexeme += c;
+ continue;
+ }
+
// If we are quoted, these are ordinary characters.
//
if (m != lexer_mode::quoted)
@@ -285,14 +302,6 @@ namespace build2
done = true;
break;
}
- case '\\':
- {
- get ();
- c = escape ();
- if (c != '\n') // Ignore.
- lexeme += c;
- continue;
- }
case '\'':
{
// If we are in the variable mode, then treat quote as just