From c1b7fd644c59ffc38f8c1e2ae798dfe93c5f6693 Mon Sep 17 00:00:00 2001 From: Nico Weber Date: Sun, 26 Jul 2020 21:06:44 -0400 Subject: [PATCH] CppLexer: Support \U escapes in addition to \u escapes --- Libraries/LibGUI/CppLexer.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Libraries/LibGUI/CppLexer.cpp b/Libraries/LibGUI/CppLexer.cpp index 26a95296b6..74cc9bd245 100644 --- a/Libraries/LibGUI/CppLexer.cpp +++ b/Libraries/LibGUI/CppLexer.cpp @@ -294,15 +294,17 @@ Vector 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;