mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-12-08 06:09:58 +00:00
LibRegex+LibUnicode: Add unicode string properties
This commit is contained in:
parent
8c8961171c
commit
7ce4abe330
Notes:
github-actions[bot]
2025-10-24 17:26:08 +00:00
Author: https://github.com/aplefull
Commit: 7ce4abe330
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/6545
Reviewed-by: https://github.com/alimpfard
Reviewed-by: https://github.com/gmta ✅
Reviewed-by: https://github.com/trflynn89
6 changed files with 139 additions and 40 deletions
|
|
@ -2463,6 +2463,19 @@ bool ECMA262Parser::parse_nested_class(Vector<regex::CompareTypeAndValuePair>& c
|
|||
compares.empend(CompareTypeAndValuePair { CharacterCompareType::Inverse, 0 });
|
||||
property.visit(
|
||||
[&](Unicode::Property property) {
|
||||
if (Unicode::is_ecma262_string_property(property)) {
|
||||
if (negated) {
|
||||
set_error(Error::InvalidNameForProperty);
|
||||
return;
|
||||
}
|
||||
|
||||
for (auto const& compare : compares) {
|
||||
if (compare.type == CharacterCompareType::Inverse) {
|
||||
set_error(Error::NegatedCharacterClassStrings);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
compares.empend(CompareTypeAndValuePair { CharacterCompareType::Property, (ByteCodeValueType)property.value() });
|
||||
},
|
||||
[&](Unicode::GeneralCategory general_category) {
|
||||
|
|
@ -2506,8 +2519,13 @@ bool ECMA262Parser::parse_unicode_property_escape(PropertyEscape& property, bool
|
|||
property = move(*parsed_property);
|
||||
|
||||
return property.visit(
|
||||
[this](Unicode::Property property) {
|
||||
if (!Unicode::is_ecma262_property(property)) {
|
||||
[this, negated](Unicode::Property property) {
|
||||
if (Unicode::is_ecma262_string_property(property)) {
|
||||
if (!m_parser_state.regex_options.has_flag_set(AllFlags::UnicodeSets) || negated) {
|
||||
set_error(Error::InvalidNameForProperty);
|
||||
return false;
|
||||
}
|
||||
} else if (!Unicode::is_ecma262_property(property)) {
|
||||
set_error(Error::InvalidNameForProperty);
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue