diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2016-11-10 16:33:12 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2016-11-10 16:33:12 +0200 |
commit | a084c6650036db9f2a8cd69e31492c5dae237793 (patch) | |
tree | ba3e34f6e85ae9e0073476b0dc46956c51039189 /build2/parser | |
parent | f1cbb7c9d5c750366fa1918a53d0682f0633b1d9 (diff) |
Implement scope-if in testscript
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 { |