mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 12:01:16 +00:00
Fix hex sequence escape.
This commit is contained in:
@@ -573,20 +573,12 @@ static inline int64_t scan_hex_literal(Lexer *lexer, int positions)
|
|||||||
for (int j = 0; j < positions; j++)
|
for (int j = 0; j < positions; j++)
|
||||||
{
|
{
|
||||||
hex <<= 4U;
|
hex <<= 4U;
|
||||||
int i = char_to_nibble(next(lexer));
|
int i = char_to_nibble(peek(lexer));
|
||||||
if (i < 0)
|
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;
|
return -1;
|
||||||
}
|
}
|
||||||
|
next(lexer);
|
||||||
hex += i;
|
hex += i;
|
||||||
}
|
}
|
||||||
return hex;
|
return hex;
|
||||||
|
|||||||
Reference in New Issue
Block a user