mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 23:47:45 +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:
parent
5de6d3dd90
commit
1e10d6d7ce
5 changed files with 77 additions and 19 deletions
|
@ -213,7 +213,9 @@ private:
|
|||
StringView read_digits_as_string(ReadDigitsInitialZeroState initial_zero = ReadDigitsInitialZeroState::Allow, bool hex = false, int max_count = -1);
|
||||
Optional<unsigned> read_digits(ReadDigitsInitialZeroState initial_zero = ReadDigitsInitialZeroState::Allow, bool hex = false, int max_count = -1);
|
||||
StringView read_capture_group_specifier(bool take_starting_angle_bracket = false);
|
||||
Optional<Unicode::Property> read_unicode_property_escape();
|
||||
|
||||
using PropertyEscape = Variant<Unicode::Property, Unicode::GeneralCategory>;
|
||||
Optional<PropertyEscape> read_unicode_property_escape();
|
||||
|
||||
bool parse_pattern(ByteCode&, size_t&, bool unicode, bool named);
|
||||
bool parse_disjunction(ByteCode&, size_t&, bool unicode, bool named);
|
||||
|
@ -227,7 +229,7 @@ private:
|
|||
bool parse_capture_group(ByteCode&, size_t&, bool unicode, bool named);
|
||||
Optional<CharClass> parse_character_class_escape(bool& out_inverse, bool expect_backslash = false);
|
||||
bool parse_nonempty_class_ranges(Vector<CompareTypeAndValuePair>&, bool unicode);
|
||||
bool parse_unicode_property_escape(Unicode::Property& property, bool& negated);
|
||||
bool parse_unicode_property_escape(PropertyEscape& property, bool& negated);
|
||||
|
||||
// Used only by B.1.4, Regular Expression Patterns (Extended for use in browsers)
|
||||
bool parse_quantifiable_assertion(ByteCode&, size_t&, bool named);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue