1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 03:37:45 +00:00

LibRegex: Partially implement the ECMAScript unicodeSets proposal

This skips the new string unicode properties additions, along with \q{}.
This commit is contained in:
Ali Mohammad Pur 2022-07-20 23:22:07 +04:30 committed by Linus Groh
parent 7734914909
commit 598dc74a76
9 changed files with 611 additions and 69 deletions

View file

@ -92,6 +92,8 @@ protected:
ALWAYS_INLINE bool done() const;
ALWAYS_INLINE bool set_error(Error error);
size_t tell() const { return m_parser_state.current_token.position(); }
struct NamedCaptureGroup {
size_t group_index { 0 };
size_t minimum_length { 0 };
@ -223,6 +225,7 @@ private:
struct ParseFlags {
bool unicode { false };
bool named { false };
bool unicode_sets { false };
};
enum class ReadDigitsInitialZeroState {
@ -257,6 +260,15 @@ private:
bool parse_character_escape(Vector<CompareTypeAndValuePair>&, size_t&, ParseFlags);
bool parse_class_set_expression(Vector<CompareTypeAndValuePair>&);
bool parse_class_union(Vector<CompareTypeAndValuePair>&);
bool parse_class_intersection(Vector<CompareTypeAndValuePair>&);
bool parse_class_subtraction(Vector<CompareTypeAndValuePair>&);
bool parse_class_set_range(Vector<CompareTypeAndValuePair>&);
bool parse_class_set_operand(Vector<CompareTypeAndValuePair>&);
bool parse_nested_class(Vector<CompareTypeAndValuePair>&);
Optional<u32> parse_class_set_character();
// Used only by B.1.4, Regular Expression Patterns (Extended for use in browsers)
bool parse_quantifiable_assertion(ByteCode&, size_t&, ParseFlags);
bool parse_extended_atom(ByteCode&, size_t&, ParseFlags);