Enum antlr_rust::errors::ANTLRError
source · [−]pub enum ANTLRError {
LexerNoAltError {
start_index: isize,
},
NoAltError(NoViableAltError),
InputMismatchError(InputMisMatchError),
PredicateError(FailedPredicateError),
IllegalStateError(String),
FallThrough(Rc<dyn Error>),
OtherError(Rc<dyn Error>),
}
Expand description
Main ANTLR4 Rust runtime error
Variants
LexerNoAltError
Fields
start_index: isize
Index at which error has happened
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.
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
sourceimpl ANTLRError
impl ANTLRError
sourcepub fn get_offending_token(&self) -> Option<&OwningToken>
pub fn get_offending_token(&self) -> Option<&OwningToken>
Returns first token that caused parser to fail.
Trait Implementations
sourceimpl Clone for ANTLRError
impl Clone for ANTLRError
sourcefn clone(&self) -> ANTLRError
fn clone(&self) -> ANTLRError
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl Debug for ANTLRError
impl Debug for ANTLRError
sourceimpl Display for ANTLRError
impl Display for ANTLRError
sourceimpl Error for ANTLRError
impl Error for ANTLRError
sourcefn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
The lower-level source of this error, if any. Read more
sourcefn backtrace(&self) -> Option<&Backtrace>
fn backtrace(&self) -> Option<&Backtrace>
backtrace
)Returns a stack backtrace, if available, of where this error occurred. Read more
1.0.0 · sourcefn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()
Auto Trait Implementations
impl !RefUnwindSafe for ANTLRError
impl !Send for ANTLRError
impl !Sync for ANTLRError
impl Unpin for ANTLRError
impl !UnwindSafe for ANTLRError
Blanket Implementations
sourceimpl<T> AnyExt for T where
T: Any + ?Sized,
impl<T> AnyExt for T where
T: Any + ?Sized,
sourcefn downcast_ref<T>(this: &Self) -> Option<&T> where
T: Any,
fn downcast_ref<T>(this: &Self) -> Option<&T> where
T: Any,
Attempts to downcast this to T
behind reference
sourcefn downcast_mut<T>(this: &mut Self) -> Option<&mut T> where
T: Any,
fn downcast_mut<T>(this: &mut Self) -> Option<&mut T> where
T: Any,
Attempts to downcast this to T
behind mutable reference
sourcefn downcast_rc<T>(this: Rc<Self>) -> Result<Rc<T>, Rc<Self>> where
T: Any,
fn downcast_rc<T>(this: Rc<Self>) -> Result<Rc<T>, Rc<Self>> where
T: Any,
Attempts to downcast this to T
behind Rc
pointer
sourcefn downcast_arc<T>(this: Arc<Self>) -> Result<Arc<T>, Arc<Self>> where
T: Any,
fn downcast_arc<T>(this: Arc<Self>) -> Result<Arc<T>, Arc<Self>> where
T: Any,
Attempts to downcast this to T
behind Arc
pointer
sourcefn downcast_box<T>(
this: Box<Self, Global>
) -> Result<Box<T, Global>, Box<Self, Global>> where
T: Any,
fn downcast_box<T>(
this: Box<Self, Global>
) -> Result<Box<T, Global>, Box<Self, Global>> where
T: Any,
Attempts to downcast this to T
behind Box
pointer
sourcefn downcast_move<T>(this: Self) -> Option<T> where
T: Any,
fn downcast_move<T>(this: Self) -> Option<T> where
T: Any,
Attempts to downcast owned Self
to T
,
useful only in generic context as a workaround for specialization Read more
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T, X> CoerceTo<T> for X where
T: CoerceFrom<X> + ?Sized,
impl<T, X> CoerceTo<T> for X where
T: CoerceFrom<X> + ?Sized,
fn coerce_rc_to(self: Rc<X>) -> Rc<T>
fn coerce_box_to(self: Box<X, Global>) -> Box<T, Global>ⓘNotable traits for Box<W, Global>impl<W> Write for Box<W, Global> where
W: Write + ?Sized, impl<R> Read for Box<R, Global> where
R: Read + ?Sized, impl<I, A> Iterator for Box<I, A> where
I: Iterator + ?Sized,
A: Allocator, type Item = <I as Iterator>::Item;impl<F, A> Future for Box<F, A> where
F: Future + Unpin + ?Sized,
A: Allocator + 'static, type Output = <F as Future>::Output;
W: Write + ?Sized, impl<R> Read for Box<R, Global> where
R: Read + ?Sized, impl<I, A> Iterator for Box<I, A> where
I: Iterator + ?Sized,
A: Allocator, type Item = <I as Iterator>::Item;impl<F, A> Future for Box<F, A> where
F: Future + Unpin + ?Sized,
A: Allocator + 'static, type Output = <F as Future>::Output;