Struct antlr_rust::error_strategy::DefaultErrorStrategy
source · [−]pub struct DefaultErrorStrategy<'input, Ctx: ParserNodeType<'input>> { /* private fields */ }
Expand description
This is the default implementation of ErrorStrategy
used for
error reporting and recovery in ANTLR parsers.
Implementations
sourceimpl<'input, Ctx: ParserNodeType<'input>> DefaultErrorStrategy<'input, Ctx>
impl<'input, Ctx: ParserNodeType<'input>> DefaultErrorStrategy<'input, Ctx>
Trait Implementations
sourceimpl<'input, Ctx: Debug + ParserNodeType<'input>> Debug for DefaultErrorStrategy<'input, Ctx> where
Ctx::Type: Debug,
impl<'input, Ctx: Debug + ParserNodeType<'input>> Debug for DefaultErrorStrategy<'input, Ctx> where
Ctx::Type: Debug,
sourceimpl<'input, Ctx: ParserNodeType<'input>> Default for DefaultErrorStrategy<'input, Ctx>
impl<'input, Ctx: ParserNodeType<'input>> Default for DefaultErrorStrategy<'input, Ctx>
sourceimpl<'a, T: Parser<'a>> ErrorStrategy<'a, T> for DefaultErrorStrategy<'a, T::Node>
impl<'a, T: Parser<'a>> ErrorStrategy<'a, T> for DefaultErrorStrategy<'a, T::Node>
sourcefn reset(&mut self, recognizer: &mut T)
fn reset(&mut self, recognizer: &mut T)
Reset the error handler state for the specified recognizer
.
sourcefn recover_inline(
&mut self,
recognizer: &mut T
) -> Result<<T::TF as TokenFactory<'a>>::Tok, ANTLRError>
fn recover_inline(
&mut self,
recognizer: &mut T
) -> Result<<T::TF as TokenFactory<'a>>::Tok, ANTLRError>
This method is called when an unexpected symbol is encountered during an
inline match operation, such as Parser::match
. If the error
strategy successfully recovers from the match failure, this method
returns the Token
instance which should be treated as the
successful result of the match. Read more
sourcefn recover(
&mut self,
recognizer: &mut T,
_e: &ANTLRError
) -> Result<(), ANTLRError>
fn recover(
&mut self,
recognizer: &mut T,
_e: &ANTLRError
) -> Result<(), ANTLRError>
This method is called to recover from error e
. This method is
called after ErrorStrategy::reportError
by the default error handler
generated for a rule method. Read more
sourcefn sync(&mut self, recognizer: &mut T) -> Result<(), ANTLRError>
fn sync(&mut self, recognizer: &mut T) -> Result<(), ANTLRError>
This method provides the error handler with an opportunity to handle syntactic or semantic errors in the input stream before they result in a error. Read more
sourcefn in_error_recovery_mode(&mut self, _recognizer: &mut T) -> bool
fn in_error_recovery_mode(&mut self, _recognizer: &mut T) -> bool
Tests whether or not {@code recognizer} is in the process of recovering
from an error. In error recovery mode, Parser::consume
will create
ErrorNode
leaf instead of TerminalNode
one Read more
sourcefn report_error(&mut self, recognizer: &mut T, e: &ANTLRError)
fn report_error(&mut self, recognizer: &mut T, e: &ANTLRError)
Report any kind of ANTLRError
. This method is called by
the default exception handler generated for a rule method. Read more
sourcefn report_match(&mut self, recognizer: &mut T)
fn report_match(&mut self, recognizer: &mut T)
This method is called when the parser successfully matches an input symbol. Read more
impl<'i, Ctx: TidAble<'i>> TidAble<'i> for DefaultErrorStrategy<'i, Ctx> where
Ctx: ParserNodeType<'i>,
Auto Trait Implementations
impl<'input, Ctx> RefUnwindSafe for DefaultErrorStrategy<'input, Ctx> where
<Ctx as ParserNodeType<'input>>::Type: RefUnwindSafe,
impl<'input, Ctx> !Send for DefaultErrorStrategy<'input, Ctx>
impl<'input, Ctx> !Sync for DefaultErrorStrategy<'input, Ctx>
impl<'input, Ctx> Unpin for DefaultErrorStrategy<'input, Ctx>
impl<'input, Ctx> UnwindSafe for DefaultErrorStrategy<'input, Ctx> where
<Ctx as ParserNodeType<'input>>::Type: RefUnwindSafe,
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;
fn coerce_ref_to(&self) -> &T
fn coerce_mut_to(&mut self) -> &mut T
sourceimpl<'a, X> TidExt<'a> for X where
X: Tid<'a> + ?Sized,
impl<'a, X> TidExt<'a> for X where
X: Tid<'a> + ?Sized,
sourcefn is<T>(&self) -> bool where
T: Tid<'a>,
fn is<T>(&self) -> bool where
T: Tid<'a>,
Returns true if type behind self is equal to the type of T.
sourcefn downcast_ref<T>(&'b self) -> Option<&'b T> where
T: Tid<'a>,
fn downcast_ref<T>(&'b self) -> Option<&'b T> where
T: Tid<'a>,
Attempts to downcast self to T
behind reference
sourcefn downcast_mut<T>(&'b mut self) -> Option<&'b mut T> where
T: Tid<'a>,
fn downcast_mut<T>(&'b mut self) -> Option<&'b mut T> where
T: Tid<'a>,
Attempts to downcast self to T
behind mutable reference
sourcefn downcast_rc<T>(self: Rc<Self>) -> Result<Rc<T>, Rc<Self>> where
T: Tid<'a>,
fn downcast_rc<T>(self: Rc<Self>) -> Result<Rc<T>, Rc<Self>> where
T: Tid<'a>,
Attempts to downcast self to T
behind Rc
pointer
sourcefn downcast_arc<T>(self: Arc<Self>) -> Result<Arc<T>, Arc<Self>> where
T: Tid<'a>,
fn downcast_arc<T>(self: Arc<Self>) -> Result<Arc<T>, Arc<Self>> where
T: Tid<'a>,
Attempts to downcast self to T
behind Arc
pointer
sourcefn downcast_box<T>(
self: Box<Self, Global>
) -> Result<Box<T, Global>, Box<Self, Global>> where
T: Tid<'a>,
fn downcast_box<T>(
self: Box<Self, Global>
) -> Result<Box<T, Global>, Box<Self, Global>> where
T: Tid<'a>,
Attempts to downcast self to T
behind Box
pointer
sourcefn downcast_move<T>(self) -> Option<T> where
T: Tid<'a>,
fn downcast_move<T>(self) -> Option<T> where
T: Tid<'a>,
Attempts to downcast owned Self
to T
,
useful only in generic context as a workaround for specialization Read more