mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 13:28:11 +00:00
LibRegex: Generate negated property escapes as a single instruction
These were previously generated as two instructions, Compare [Inverse] and Compare [Property].
This commit is contained in:
parent
4de4312827
commit
dc9f516339
2 changed files with 16 additions and 3 deletions
|
@ -1546,15 +1546,18 @@ bool ECMA262Parser::parse_atom_escape(ByteCode& stack, size_t& match_length_mini
|
|||
bool negated = false;
|
||||
|
||||
if (parse_unicode_property_escape(property, negated)) {
|
||||
Vector<CompareTypeAndValuePair> compares;
|
||||
if (negated)
|
||||
stack.insert_bytecode_compare_values({ { CharacterCompareType::Inverse, 0 } });
|
||||
compares.empend(CompareTypeAndValuePair { CharacterCompareType::Inverse, 0 });
|
||||
property.visit(
|
||||
[&](Unicode::Property property) {
|
||||
stack.insert_bytecode_compare_values({ { CharacterCompareType::Property, (ByteCodeValueType)(property) } });
|
||||
compares.empend(CompareTypeAndValuePair { CharacterCompareType::Property, (ByteCodeValueType)property });
|
||||
},
|
||||
[&](Unicode::GeneralCategory general_category) {
|
||||
stack.insert_bytecode_compare_values({ { CharacterCompareType::GeneralCategory, (ByteCodeValueType)(general_category) } });
|
||||
compares.empend(CompareTypeAndValuePair { CharacterCompareType::GeneralCategory, (ByteCodeValueType)general_category });
|
||||
});
|
||||
stack.insert_bytecode_compare_values(move(compares));
|
||||
match_length_minimum += 1;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue