From e20e6071c8a104e0e960309032f4743bedf884e2 Mon Sep 17 00:00:00 2001 From: Christoffer Lerno Date: Fri, 3 Dec 2021 17:29:25 +0100 Subject: [PATCH] Fix hex sequence escape. --- src/compiler/lexer.c | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/src/compiler/lexer.c b/src/compiler/lexer.c index b4662ba09..c17e9c829 100644 --- a/src/compiler/lexer.c +++ b/src/compiler/lexer.c @@ -573,20 +573,12 @@ static inline int64_t scan_hex_literal(Lexer *lexer, int positions) for (int j = 0; j < positions; j++) { hex <<= 4U; - int i = char_to_nibble(next(lexer)); + int i = char_to_nibble(peek(lexer)); if (i < 0) { - if (lexer->current[-1] == '\'') - { - backtrack(lexer); - return -1; - } - while (lexer->current[0] != '\'' && lexer->current[0] != '\0' && ++j < positions) - { - next(lexer); - } return -1; } + next(lexer); hex += i; } return hex;