1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 19:58:11 +00:00

LibRegex: Support property escapes of Unicode General Categories

This changes LibRegex to parse the property escape as a Variant of
Unicode Property & General Category values. A byte code instruction is
added to perform matching based on General Category values.
This commit is contained in:
Timothy Flynn 2021-07-31 17:46:05 -04:00 committed by Ali Mohammad Pur
parent 5de6d3dd90
commit 1e10d6d7ce
5 changed files with 77 additions and 19 deletions

View file

@ -661,6 +661,12 @@ TEST_CASE(ECMA262_property_match)
{ "\\p{ASCII_Hex_Digit}", "x", false, ECMAScriptFlags::Unicode },
{ "\\p{Any}", "\xcd\xb8", true, ECMAScriptFlags::Unicode }, // U+0378, which is an unassigned code point.
{ "\\p{Assigned}", "\xcd\xb8", false, ECMAScriptFlags::Unicode }, // U+0378, which is an unassigned code point.
{ "\\p{Lu}", "a", false, ECMAScriptFlags::Unicode },
{ "\\p{Lu}", "A", true, ECMAScriptFlags::Unicode },
{ "\\p{Lu}", "9", false, ECMAScriptFlags::Unicode },
{ "\\p{Cased_Letter}", "a", true, ECMAScriptFlags::Unicode },
{ "\\p{Cased_Letter}", "A", true, ECMAScriptFlags::Unicode },
{ "\\p{Cased_Letter}", "9", false, ECMAScriptFlags::Unicode },
};
for (auto& test : tests) {