Enum regex_syntax::ErrorKind [] [src]

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),
    StackExhausted,
    FlagNotAllowed(char),
    UnicodeNotAllowed,
    InvalidUtf8,
    EmptyClass,
    // some variants omitted
}

The specific type of parse error that can occur.

Variants

A negation symbol is used twice in flag settings. e.g., (?-i-s).

The same capture name was used more than once. e.g., (?P<a>.)(?P<a>.).

An alternate is empty. e.g., (|a).

A capture group name is empty. e.g., (?P<>a).

A negation symbol was not proceded by any flags. e.g., (?i-).

A group is empty. e.g., ().

An invalid number was used in a counted repetition. e.g., a{b}.

An invalid hexadecimal number was used in an escape sequence. e.g., \xAG.

An invalid capture name was used. e.g., (?P<0a>b).

An invalid class range was givien. Specifically, when the start of the range is greater than the end. e.g., [z-a].

Fields

The first character specified in the range.

The second character specified in the range.

An escape sequence was used in a character class where it is not allowed. e.g., [a-\pN] or [\A].

An invalid counted repetition min/max was given. e.g., a{2,1}.

Fields

The first number specified in the repetition.

The second number specified in the repetition.

An invalid Unicode scalar value was used in a long hexadecimal sequence. e.g., \x{D800}.

An empty counted repetition operator. e.g., a{}.

A repetition operator was not applied to an expression. e.g., *.

A repetition operator was applied to an expression that cannot be repeated. e.g., a+* or a|*.

A capture group name that is never closed. e.g., (?P<a.

An unclosed hexadecimal literal. e.g., \x{a.

An unclosed parenthesis. e.g., (a.

An unclosed counted repetition operator. e.g., a{2.

An unclosed named Unicode class. e.g., \p{Yi.

Saw end of regex before class was closed. e.g., [a.

Saw end of regex before escape sequence was closed. e.g., \.

Saw end of regex before flags were closed. e.g., (?i.

Saw end of regex before two hexadecimal digits were seen. e.g., \xA.

Unopened parenthesis. e.g., ).

Unrecognized escape sequence. e.g., \q.

Unrecognized flag. e.g., (?a).

Unrecognized named Unicode class. e.g., \p{Foo}.

Indicates that the regex uses too much nesting.

(N.B. This error exists because traversing the Expr is recursive and an explicit heap allocated stack is not (yet?) used. Regardless, some sort of limit must be applied to avoid unbounded memory growth.

A disallowed flag was found (e.g., u).

A Unicode class was used when the Unicode (u) flag was disabled.

InvalidUtf8 indicates that the expression may match non-UTF-8 bytes. This never returned if the parser is permitted to allow expressions that match arbitrary bytes.

A character class was constructed such that it is empty. e.g., [^\d\D].

Trait Implementations

impl Clone for ErrorKind
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl Debug for ErrorKind
[src]

Formats the value using the given formatter.

impl PartialEq for ErrorKind
[src]

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

impl Display for ErrorKind
[src]

Formats the value using the given formatter.