aboutsummaryrefslogtreecommitdiff
path: root/build/lexer
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2015-03-02 09:10:28 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2015-03-02 09:10:28 +0200
commitfbd3c230d3861084b7316a6d5a8597cb00c9510b (patch)
treea5e1d1f5aeb77d74c66ac9874925d6e951cc0d3a /build/lexer
parentbbd05eb0c32a9614f012a1d9b75cef736a1d4150 (diff)
Implement value lexing mode
So that we can do foo=g++ without having to resort to quoting
Diffstat (limited to 'build/lexer')
-rw-r--r--build/lexer11
1 files changed, 9 insertions, 2 deletions
diff --git a/build/lexer b/build/lexer
index 1944727..1723ae0 100644
--- a/build/lexer
+++ b/build/lexer
@@ -100,10 +100,17 @@ namespace build
std::uint64_t l_ {1};
std::uint64_t c_ {1};
- bool eos_ {false};
-
bool unget_ {false};
xchar buf_ {0, 0, 0};
+
+ bool eos_ {false};
+
+ // Context-dependent lexing mode. In the value mode we don't treat
+ // certain characters (e.g., +, =) as special so that we can use
+ // them in the variable values, e.g., 'foo = g++'.
+ //
+ enum class mode {normal, value};
+ mode mode_ {mode::normal};
};
}