mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-30 20:59:16 +00:00
LibRegex: Add basic support for unicode escapes in ECMA262Parser
This parses unicode escapes (and matches them only for utf8 strings).
This commit is contained in:
parent
86811683b0
commit
765d2977bc
Notes:
sideshowbarker
2024-07-19 01:01:54 +09:00
Author: https://github.com/alimpfard
Commit: 765d2977bc
Pull-request: https://github.com/SerenityOS/serenity/pull/4333
2 changed files with 31 additions and 4 deletions
|
@ -477,6 +477,7 @@ TEST_CASE(ECMA262_parse)
|
|||
struct _test {
|
||||
const char* pattern;
|
||||
regex::Error expected_error { regex::Error::NoError };
|
||||
regex::ECMAScriptFlags flags {};
|
||||
};
|
||||
|
||||
constexpr _test tests[] {
|
||||
|
@ -497,6 +498,8 @@ TEST_CASE(ECMA262_parse)
|
|||
{ "\\x" }, // Even invalid escapes are allowed if ~unicode.
|
||||
{ "\\", regex::Error::InvalidTrailingEscape },
|
||||
{ "(?", regex::Error::InvalidCaptureGroup },
|
||||
{ "\\u1234", regex::Error::NoError, regex::ECMAScriptFlags::Unicode },
|
||||
{ "[\\u1234]", regex::Error::NoError, regex::ECMAScriptFlags::Unicode },
|
||||
};
|
||||
|
||||
for (auto& test : tests) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue