mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-24 09:52:31 +00:00
AK+LibJS: Extract some UTF-16 helpers for use in an outside class
An upcoming Utf16String will need access to these helpers. Let's make them publicly available.
This commit is contained in:
parent
b6dc5050d2
commit
66006d3812
Notes:
github-actions[bot]
2025-07-03 13:54:12 +00:00
Author: https://github.com/trflynn89
Commit: 66006d3812
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/5228
Reviewed-by: https://github.com/ADKaster ✅
Reviewed-by: https://github.com/shannonbooth
10 changed files with 121 additions and 86 deletions
|
@ -9,13 +9,14 @@
|
|||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include "Parser.h"
|
||||
#include <AK/Array.h>
|
||||
#include <AK/CharacterTypes.h>
|
||||
#include <AK/HashTable.h>
|
||||
#include <AK/ScopeGuard.h>
|
||||
#include <AK/StdLibExtras.h>
|
||||
#include <AK/TemporaryChange.h>
|
||||
#include <AK/UnicodeUtils.h>
|
||||
#include <LibJS/Parser.h>
|
||||
#include <LibJS/Runtime/RegExpObject.h>
|
||||
#include <LibRegex/Regex.h>
|
||||
|
||||
|
@ -4601,7 +4602,7 @@ FlyString Parser::consume_string_value()
|
|||
Utf8View view { value.bytes_as_string_view().substring_view(value.bytes().size() - 3) };
|
||||
VERIFY(view.length() <= 3);
|
||||
auto codepoint = *view.begin();
|
||||
if (Utf16View::is_high_surrogate(codepoint)) {
|
||||
if (AK::UnicodeUtils::is_utf16_high_surrogate(codepoint)) {
|
||||
syntax_error("StringValue ending with unpaired high surrogate"_string);
|
||||
VERIFY(view.length() == 1);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue