diff options
Diffstat (limited to 'build2/parser')
-rw-r--r-- | build2/parser | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/build2/parser b/build2/parser index aaee359..0b3a807 100644 --- a/build2/parser +++ b/build2/parser @@ -287,6 +287,23 @@ namespace build2 token_type peek (); + token_type + peek (lexer_mode m, char ps = '@') + { + // The idea is that if we already have something peeked, then it should + // be in the same mode. We also don't re-set the mode since it may have + // expired after the first token. + // + if (peeked_) + { + assert (peek_.mode == m); + return peek_.token.type; + } + + mode (m, ps); + return peek (); + } + const token& peeked () const { |