Enum regex_syntax::ast::ErrorKind [] [src]

pub enum ErrorKind {
    CaptureLimitExceeded,
    ClassEscapeInvalid,
    ClassRangeInvalid,
    ClassRangeLiteral,
    ClassUnclosed,
    DecimalEmpty,
    DecimalInvalid,
    EscapeHexEmpty,
    EscapeHexInvalid,
    EscapeHexInvalidDigit,
    EscapeUnexpectedEof,
    EscapeUnrecognized,
    FlagDanglingNegation,
    FlagDuplicate {
        original: Span,
    },
    FlagRepeatedNegation {
        original: Span,
    },
    FlagUnexpectedEof,
    FlagUnrecognized,
    GroupNameDuplicate {
        original: Span,
    },
    GroupNameEmpty,
    GroupNameInvalid,
    GroupNameUnexpectedEof,
    GroupUnclosed,
    GroupUnopened,
    NestLimitExceeded(u32),
    RepetitionCountInvalid,
    RepetitionCountUnclosed,
    RepetitionMissing,
    UnsupportedBackreference,
    UnsupportedLookAround,
    // some variants omitted
}

The type of an error that occurred while building an AST.

Variants

The capturing group limit was exceeded.

Note that this represents a limit on the total number of capturing groups in a regex and not necessarily the number of nested capturing groups. That is, the nest limit can be low and it is still possible for this error to occur.

An invalid escape sequence was found in a character class set.

An invalid character class range was found. An invalid range is any range where the start is greater than the end.

An invalid range boundary was found in a character class. Range boundaries must be a single literal codepoint, but this error indicates that something else was found, such as a nested class.

An opening [ was found with no corresponding closing ].

An empty decimal number was given where one was expected.

An invalid decimal number was given where one was expected.

A bracketed hex literal was empty.

A bracketed hex literal did not correspond to a Unicode scalar value.

An invalid hexadecimal digit was found.

EOF was found before an escape sequence was completed.

An unrecognized escape sequence.

A dangling negation was used when setting flags, e.g., i-.

A flag was used twice, e.g., i-i.

Fields of FlagDuplicate

The position of the original flag. The error position points to the duplicate flag.

The negation operator was used twice, e.g., -i-s.

Fields of FlagRepeatedNegation

The position of the original negation operator. The error position points to the duplicate negation operator.

Expected a flag but got EOF, e.g., (?.

Unrecognized flag, e.g., a.

A duplicate capture name was found.

Fields of GroupNameDuplicate

The position of the initial occurrence of the capture name. The error position itself points to the duplicate occurrence.

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

An invalid character was seen for a capture group name. This includes errors where the first character is a digit (even though subsequent characters are allowed to be digits).

A closing > could not be found for a capture group name.

An unclosed group, e.g., (ab.

The span of this error corresponds to the unclosed parenthesis.

An unopened group, e.g., ab).

The nest limit was exceeded. The limit stored here is the limit configured in the parser.

The range provided in a counted repetition operator is invalid. The range is invalid if the start is greater than the end.

An opening { was found with no corresponding closing }.

A repetition operator was applied to a missing sub-expression. This occurs, for example, in the regex consisting of just a * or even (?i)*. It is, however, possible to create a repetition operating on an empty sub-expression. For example, ()* is still considered valid.

When octal support is disabled, this error is produced when an octal escape is used. The octal escape is assumed to be an invocation of a backreference, which is the common case.

When syntax similar to PCRE's look-around is used, this error is returned. Some example syntaxes that are rejected include, but are not necessarily limited to, (?=re), (?!re), (?<=re) and (?<!re). Note that all of these syntaxes are otherwise invalid; this error is used to improve the user experience.

Trait Implementations

impl Clone for ErrorKind
[src]

[src]

Returns a copy of the value. Read more

1.0.0
[src]

Performs copy-assignment from source. Read more

impl Debug for ErrorKind
[src]

[src]

Formats the value using the given formatter. Read more

impl Eq for ErrorKind
[src]

impl PartialEq for ErrorKind
[src]

[src]

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

[src]

This method tests for !=.

impl Display for ErrorKind
[src]

[src]

Formats the value using the given formatter. Read more

Auto Trait Implementations

impl Send for ErrorKind

impl Sync for ErrorKind