diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2015-09-08 11:10:46 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2015-09-08 11:10:46 +0200 |
commit | 18af73df698e560b847e46d524d059d2921876d5 (patch) | |
tree | 2607b489bf892111a7755cdf158daa928c6d9bd4 | |
parent | eb264e1892c2a1379fa3bcab9aefea219e8e7138 (diff) |
Clean up lexer mode logic
-rw-r--r-- | build/lexer | 4 | ||||
-rw-r--r-- | build/lexer.cxx | 2 | ||||
-rw-r--r-- | build/parser.cxx | 1 |
3 files changed, 4 insertions, 3 deletions
diff --git a/build/lexer b/build/lexer index 1e5bfd0..e5676cc 100644 --- a/build/lexer +++ b/build/lexer @@ -23,7 +23,9 @@ namespace build // in the variable mode, we restrict certain character (e.g., /) // from appearing in the name. The pairs mode is just like value // except that we split names separated by the pair character. - // The pairs mode must be set manually. + // The alternnative modes must be set manually. The value and + // pairs modes are automatically reset after the end of the line. + // The variable mode is automatically reset after the name token. // enum class lexer_mode {normal, value, variable, pairs}; diff --git a/build/lexer.cxx b/build/lexer.cxx index fb4d9ea..88628d3 100644 --- a/build/lexer.cxx +++ b/build/lexer.cxx @@ -83,12 +83,10 @@ namespace build if (get () != '=') fail (c) << "expected = after +"; - next_mode_ = lexer_mode::value; return token (token_type::plus_equal, sep, ln, cn); } case '=': { - next_mode_ = lexer_mode::value; return token (token_type::equal, sep, ln, cn); } } diff --git a/build/parser.cxx b/build/parser.cxx index 6c3e4bc..f140bc7 100644 --- a/build/parser.cxx +++ b/build/parser.cxx @@ -637,6 +637,7 @@ namespace build ? &scope_->assign (*var) : &scope_->append (*var); next (t, tt); // Consume =/+=. + lexer_->mode (lexer_mode::value); next (t, tt); } } |