pub enum ErrorKind {
DoubleFlagNegation,
DuplicateCaptureName(String),
EmptyAlternate,
EmptyCaptureName,
EmptyFlagNegation,
EmptyGroup,
InvalidBase10(String),
InvalidBase16(String),
InvalidCaptureName(String),
InvalidClassRange {
start: char,
end: char,
},
InvalidClassEscape(Expr),
InvalidRepeatRange {
min: u32,
max: u32,
},
InvalidScalarValue(u32),
MissingBase10,
RepeaterExpectsExpr,
RepeaterUnexpectedExpr(Expr),
UnclosedCaptureName(String),
UnclosedHex,
UnclosedParen,
UnclosedRepeat,
UnclosedUnicodeName,
UnexpectedClassEof,
UnexpectedEscapeEof,
UnexpectedFlagEof,
UnexpectedTwoDigitHexEof,
UnopenedParen,
UnrecognizedEscape(char),
UnrecognizedFlag(char),
UnrecognizedUnicodeClass(String),
// some variants omitted
}The specific type of parse error that can occur.
Variants
DoubleFlagNegation | A negation symbol is used twice in flag settings.
e.g., (?-i-s).
|
DuplicateCaptureName | The same capture name was used more than once.
e.g., (?P<a>.)(?P<a>.).
|
EmptyAlternate | An alternate is empty. e.g., (|a).
|
EmptyCaptureName | A capture group name is empty. e.g., (?P<>a).
|
EmptyFlagNegation | A negation symbol was not proceded by any flags. e.g., (?i-).
|
EmptyGroup | A group is empty. e.g., ().
|
InvalidBase10 | An invalid number was used in a counted repetition. e.g., a{b}.
|
InvalidBase16 | An invalid hexadecimal number was used in an escape sequence.
e.g., \xAG.
|
InvalidCaptureName | An invalid capture name was used. e.g., (?P<0a>b).
|
InvalidClassRange | An invalid class range was givien. Specifically, when the start of the
range is greater than the end. e.g., [z-a].
Fields
start | The first character specified in the range.
| end | The second character specified in the range.
|
|
InvalidClassEscape | An escape sequence was used in a character class where it is not
allowed. e.g., [a-\pN] or [\A].
|
InvalidRepeatRange | An invalid counted repetition min/max was given. e.g., a{2,1}.
Fields
min | The first number specified in the repetition.
| max | The second number specified in the repetition.
|
|
InvalidScalarValue | An invalid Unicode scalar value was used in a long hexadecimal
sequence. e.g., \x{D800}.
|
MissingBase10 | An empty counted repetition operator. e.g., a{}.
|
RepeaterExpectsExpr | A repetition operator was not applied to an expression. e.g., *.
|
RepeaterUnexpectedExpr | A repetition operator was applied to an expression that cannot be
repeated. e.g., a+* or a|*.
|
UnclosedCaptureName | A capture group name that is never closed. e.g., (?P<a.
|
UnclosedHex | An unclosed hexadecimal literal. e.g., \x{a.
|
UnclosedParen | An unclosed parenthesis. e.g., (a.
|
UnclosedRepeat | An unclosed counted repetition operator. e.g., a{2.
|
UnclosedUnicodeName | An unclosed named Unicode class. e.g., \p{Yi.
|
UnexpectedClassEof | Saw end of regex before class was closed. e.g., [a.
|
UnexpectedEscapeEof | Saw end of regex before escape sequence was closed. e.g., \.
|
UnexpectedFlagEof | Saw end of regex before flags were closed. e.g., (?i.
|
UnexpectedTwoDigitHexEof | Saw end of regex before two hexadecimal digits were seen. e.g., \xA.
|
UnopenedParen | Unopened parenthesis. e.g., ).
|
UnrecognizedEscape | Unrecognized escape sequence. e.g., \q.
|
UnrecognizedFlag | Unrecognized flag. e.g., (?a).
|
UnrecognizedUnicodeClass | Unrecognized named Unicode class. e.g., \p{Foo}.
|
Trait Implementations
Derived Implementations