mirror of
https://github.com/RGBCube/serenity
synced 2025-05-30 19:38:12 +00:00
CppLexer: Support \U escapes in addition to \u escapes
This commit is contained in:
parent
58308748cb
commit
c1b7fd644c
1 changed files with 5 additions and 3 deletions
|
@ -294,15 +294,17 @@ Vector<CppToken> CppLexer::lex()
|
|||
}
|
||||
return 2 + hex_digits;
|
||||
}
|
||||
case 'u': {
|
||||
case 'u':
|
||||
case 'U': {
|
||||
bool is_unicode = true;
|
||||
for (size_t i = 0; i < 4; ++i) {
|
||||
size_t number_of_digits = peek(1) == 'u' ? 4 : 8;
|
||||
for (size_t i = 0; i < number_of_digits; ++i) {
|
||||
if (!isxdigit(peek(2 + i))) {
|
||||
is_unicode = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return is_unicode ? 6 : 0;
|
||||
return is_unicode ? 2 + number_of_digits : 0;
|
||||
}
|
||||
default:
|
||||
return 0;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue