Fix Berry lexer regression

This commit is contained in:
Stephan Hadinger 2022-07-02 15:48:48 +02:00
parent 7ad3a0e45b
commit 8348b3fb25
1 changed files with 5 additions and 1 deletions

View File

@ -336,7 +336,11 @@ static btokentype scan_decimal(blexer *lexer)
{
btokentype type = TokenInteger;
match(lexer, is_digit);
if (decimal_dots(lexer) || scan_realexp(lexer)) {
/* decimal_dots() and scan_realexp() have side effect, so we call each explicitly */
/* to prevent binary shortcut if the first is true */
bbool has_decimal_dots = decimal_dots(lexer);
bbool is_realexp = scan_realexp(lexer);
if (has_decimal_dots || is_realexp) {
type = TokenReal;
}
lexer->buf.s[lexer->buf.len] = '\0';