aboutsummaryrefslogtreecommitdiff
path: root/build/lexer.cxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2015-12-07 12:16:29 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2015-12-07 12:16:29 +0200
commit8b55e8151bd69e4ef11a67aff57618193f559618 (patch)
treee420000affbf3c6d7016470649d2cc711b883c7a /build/lexer.cxx
parentc092793e74d0778b0aff653860f274c8cc31c374 (diff)
Add support for specifying minimum required build2 version
The syntax is: using build@0.1.0-a1 The idea is that we will later also use it for modules and 'build' is a special, the "build system itself" module. Also fix a problem with peeking and lexer mode switching.
Diffstat (limited to 'build/lexer.cxx')
-rw-r--r--build/lexer.cxx13
1 files changed, 13 insertions, 0 deletions
diff --git a/build/lexer.cxx b/build/lexer.cxx
index 79611c6..77e803c 100644
--- a/build/lexer.cxx
+++ b/build/lexer.cxx
@@ -17,6 +17,16 @@ namespace build
return t;
}
+ pair<char, bool> lexer::
+ peek_char ()
+ {
+ // In the quoted mode we don't skip spaces.
+ //
+ sep_ = mode_.top () != lexer_mode::quoted && skip_spaces ();
+ xchar c (peek ());
+ return make_pair (eos (c) ? '\0' : char (c), sep_);
+ }
+
token lexer::
next_impl ()
{
@@ -385,6 +395,9 @@ namespace build
get ();
}
+ r = r || sep_;
+ sep_ = false;
+
return r;
}