Skip to content

Commit

Permalink
Fix for hexadecimal escapes of the from \x{62}.
Browse files Browse the repository at this point in the history
  • Loading branch information
MaxSagebaum committed Jul 8, 2024
1 parent 2633251 commit 10115ca
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion source/lex.h
Original file line number Diff line number Diff line change
Expand Up @@ -939,17 +939,31 @@ auto lex_line(
if (
peek( offset) == '\\'
&& peek(1+offset) == 'x'
&& is_hexadecimal_digit(peek(2+offset))
&& (is_hexadecimal_digit(peek(2+offset))
|| (peek(2+offset) == '{' && is_hexadecimal_digit(peek(3+offset)))
)
)
{
bool has_bracket = peek(2+offset) == '{';
auto j = 3;

if (has_bracket) { ++j; }

while (
peek(j+offset)
&& is_hexadecimal_digit(peek(j+offset))
)
{
++j;
}

if (has_bracket) {
if (peek(j+offset) == '}') {
++j;
} else {
return 0;
}
}
return j;
}
return 0;
Expand Down

0 comments on commit 10115ca

Please sign in to comment.