[][src]Enum antlr_rust::errors::ANTLRError

pub enum ANTLRError {
    LexerNoAltError {
        start_index: isize,
    },
    NoAltError(NoViableAltError),
    InputMismatchError(InputMisMatchError),
    PredicateError(FailedPredicateError),
    IllegalStateError(String),
    FallThrough(Rc<dyn Error>),
    OtherError(Rc<dyn Error>),
}

Main ANTLR4 Rust runtime error

Variants

LexerNoAltError

Returned from Lexer when it fails to find matching token type for current input

Usually Lexers contain last rule that captures all invalid tokens like:

ERROR_TOKEN: . ;

to prevent lexer from throwing errors and have all error handling in parser.

Fields of LexerNoAltError

start_index: isize

Index at which error has happened

NoAltError(NoViableAltError)

Indicates that the parser could not decide which of two or more paths to take based upon the remaining input. It tracks the starting token of the offending input and also knows where the parser was in the various paths when the error. Reported by reportNoViableAlternative()

InputMismatchError(InputMisMatchError)

This signifies any kind of mismatched input exceptions such as when the current input does not match the expected token.

PredicateError(FailedPredicateError)

A semantic predicate failed during validation. Validation of predicates occurs when normally parsing the alternative just like matching a token. Disambiguating predicate evaluation occurs when we test a predicate during prediction.

IllegalStateError(String)

Internal error. Or user provided type returned data that is incompatible with current parser state

FallThrough(Rc<dyn Error>)

Unrecoverable error. Indicates that error should not be processed by parser/error strategy and it should abort parsing and immediately return to caller.

OtherError(Rc<dyn Error>)

Potentially recoverable error. Used to allow user to emit his own errors from parser actions or from custom error strategy. Parser will try to recover with provided ErrorStrategy

Implementations

impl ANTLRError[src]

pub fn get_offending_token(&self) -> Option<&OwningToken>[src]

Returns first token that caused parser to fail.

Trait Implementations

impl Clone for ANTLRError[src]

impl Debug for ANTLRError[src]

impl Display for ANTLRError[src]

impl Error for ANTLRError[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> NodeText for T[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.