From 630b498533f5a9a1e9d40893f4806ef855f1e03b Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Fri, 1 May 2020 17:09:59 +0200 Subject: Fix outstanding issue with directive vs assignment differentiation Specifically, now the following does the right thing: print +foo --- libbuild2/lexer.hxx | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'libbuild2/lexer.hxx') 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 - 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, bool> + peek_chars (); protected: struct state -- cgit v1.1