mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 01:37:36 +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:
parent
7734914909
commit
598dc74a76
9 changed files with 611 additions and 69 deletions
|
@ -18,24 +18,25 @@ namespace regex {
|
|||
|
||||
enum class Error : u8 {
|
||||
NoError = __Regex_NoError,
|
||||
InvalidPattern = __Regex_InvalidPattern, // Invalid regular expression.
|
||||
InvalidCollationElement = __Regex_InvalidCollationElement, // Invalid collating element referenced.
|
||||
InvalidCharacterClass = __Regex_InvalidCharacterClass, // Invalid character class type referenced.
|
||||
InvalidTrailingEscape = __Regex_InvalidTrailingEscape, // Trailing \ in pattern.
|
||||
InvalidNumber = __Regex_InvalidNumber, // Number in \digit invalid or in error.
|
||||
MismatchingBracket = __Regex_MismatchingBracket, // [ ] imbalance.
|
||||
MismatchingParen = __Regex_MismatchingParen, // ( ) imbalance.
|
||||
MismatchingBrace = __Regex_MismatchingBrace, // { } imbalance.
|
||||
InvalidBraceContent = __Regex_InvalidBraceContent, // Content of {} invalid: not a number, number too large, more than two numbers, first larger than second.
|
||||
InvalidBracketContent = __Regex_InvalidBracketContent, // Content of [] invalid.
|
||||
InvalidRange = __Regex_InvalidRange, // Invalid endpoint in range expression.
|
||||
InvalidRepetitionMarker = __Regex_InvalidRepetitionMarker, // ?, * or + not preceded by valid regular expression.
|
||||
ReachedMaxRecursion = __Regex_ReachedMaxRecursion, // MaximumRecursion has been reached.
|
||||
EmptySubExpression = __Regex_EmptySubExpression, // Sub expression has empty content.
|
||||
InvalidCaptureGroup = __Regex_InvalidCaptureGroup, // Content of capture group is invalid.
|
||||
InvalidNameForCaptureGroup = __Regex_InvalidNameForCaptureGroup, // Name of capture group is invalid.
|
||||
InvalidNameForProperty = __Regex_InvalidNameForProperty, // Name of property is invalid.
|
||||
DuplicateNamedCapture = __Regex_DuplicateNamedCapture, // Name of property is invalid.
|
||||
InvalidPattern = __Regex_InvalidPattern, // Invalid regular expression.
|
||||
InvalidCollationElement = __Regex_InvalidCollationElement, // Invalid collating element referenced.
|
||||
InvalidCharacterClass = __Regex_InvalidCharacterClass, // Invalid character class type referenced.
|
||||
InvalidTrailingEscape = __Regex_InvalidTrailingEscape, // Trailing \ in pattern.
|
||||
InvalidNumber = __Regex_InvalidNumber, // Number in \digit invalid or in error.
|
||||
MismatchingBracket = __Regex_MismatchingBracket, // [ ] imbalance.
|
||||
MismatchingParen = __Regex_MismatchingParen, // ( ) imbalance.
|
||||
MismatchingBrace = __Regex_MismatchingBrace, // { } imbalance.
|
||||
InvalidBraceContent = __Regex_InvalidBraceContent, // Content of {} invalid: not a number, number too large, more than two numbers, first larger than second.
|
||||
InvalidBracketContent = __Regex_InvalidBracketContent, // Content of [] invalid.
|
||||
InvalidRange = __Regex_InvalidRange, // Invalid endpoint in range expression.
|
||||
InvalidRepetitionMarker = __Regex_InvalidRepetitionMarker, // ?, * or + not preceded by valid regular expression.
|
||||
ReachedMaxRecursion = __Regex_ReachedMaxRecursion, // MaximumRecursion has been reached.
|
||||
EmptySubExpression = __Regex_EmptySubExpression, // Sub expression has empty content.
|
||||
InvalidCaptureGroup = __Regex_InvalidCaptureGroup, // Content of capture group is invalid.
|
||||
InvalidNameForCaptureGroup = __Regex_InvalidNameForCaptureGroup, // Name of capture group is invalid.
|
||||
InvalidNameForProperty = __Regex_InvalidNameForProperty, // Name of property is invalid.
|
||||
DuplicateNamedCapture = __Regex_DuplicateNamedCapture, // Name of property is invalid.
|
||||
InvalidCharacterClassEscape = __Regex_InvalidCharacterClassEscape, // Invalid escaped entity in character class.
|
||||
};
|
||||
|
||||
inline String get_error_string(Error error)
|
||||
|
@ -79,6 +80,8 @@ inline String get_error_string(Error error)
|
|||
return "Name of property is invalid.";
|
||||
case Error::DuplicateNamedCapture:
|
||||
return "Duplicate capture group name";
|
||||
case Error::InvalidCharacterClassEscape:
|
||||
return "Invalid escaped entity in character class.";
|
||||
}
|
||||
return "Undefined error.";
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue