From 8b55e8151bd69e4ef11a67aff57618193f559618 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Mon, 7 Dec 2015 12:16:29 +0200 Subject: 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. --- build/lexer | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'build/lexer') diff --git a/build/lexer b/build/lexer index 6880d39..4a50e2a 100644 --- a/build/lexer +++ b/build/lexer @@ -15,6 +15,9 @@ #include +#include +#include + #include #include @@ -43,7 +46,7 @@ namespace build lexer (std::istream& is, const std::string& name, void (*processor) (token&, const lexer&) = nullptr) - : char_scanner (is), fail (name), processor_ (processor) + : char_scanner (is), fail (name), processor_ (processor), sep_ (false) { mode_.push (lexer_mode::normal); } @@ -77,6 +80,13 @@ namespace build token next (); + // Peek at the first character of the next token. Return the character + // or 0 if the next token will be eos. Also return an indicator of + // whether the next token will be separated. + // + pair + peek_char (); + private: token next_impl (); @@ -121,6 +131,7 @@ namespace build std::stack mode_; char pair_separator_; + bool sep_; // True if we skipped spaces in peek(). }; } -- cgit v1.1