aboutsummaryrefslogtreecommitdiff
path: root/libbuild2/lexer.hxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2020-05-01 17:09:59 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2020-05-01 17:12:04 +0200
commit630b498533f5a9a1e9d40893f4806ef855f1e03b (patch)
tree18657642a3d0deffc1ed14ad449bd6f3ac4b1e64 /libbuild2/lexer.hxx
parentc7e9f97fc7684c01c692916be1ac2cfc92024a0c (diff)
Fix outstanding issue with directive vs assignment differentiation
Specifically, now the following does the right thing: print +foo
Diffstat (limited to 'libbuild2/lexer.hxx')
-rw-r--r--libbuild2/lexer.hxx15
1 files changed, 10 insertions, 5 deletions
diff --git a/libbuild2/lexer.hxx b/libbuild2/lexer.hxx
index e9a3149..02112cb 100644
--- a/libbuild2/lexer.hxx
+++ b/libbuild2/lexer.hxx
@@ -142,12 +142,17 @@ namespace build2
virtual 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.
+ // Peek at the first two characters of the next token(s). Return the
+ // characters or '\0' if either would be eos. Also return an indicator of
+ // whether the next token would be separated. Note: cannot be used to peek
+ // at the first character of a line.
//
- pair<char, bool>
- peek_char ();
+ // Note also that it assumes that the current mode and the potential new
+ // mode in which these characters will actually be parsed use the same
+ // whitespace separation (the sep_space and sep_newline values).
+ //
+ pair<pair<char, char>, bool>
+ peek_chars ();
protected:
struct state