Skip to main content

DefaultErrorStrategy

Struct DefaultErrorStrategy 

Source
pub struct DefaultErrorStrategy<'input, 'arena, TF, P>
where TF: TokenFactory<'input, 'arena> + 'arena, P: Parser<'input, 'arena, TF>, 'input: 'arena,
{ /* private fields */ }
Expand description

This is the default implementation of ErrorStrategy used for error reporting and recovery in ANTLR parsers.

Implementations§

Source§

impl<'input, 'arena, TF, P> DefaultErrorStrategy<'input, 'arena, TF, P>
where TF: TokenFactory<'input, 'arena> + 'arena, P: Parser<'input, 'arena, TF>, 'input: 'arena,

Source

pub fn new() -> Self

Creates new instance of DefaultErrorStrategy

Trait Implementations§

Source§

impl<'input, 'arena, TF, P> Debug for DefaultErrorStrategy<'input, 'arena, TF, P>
where TF: TokenFactory<'input, 'arena> + 'arena + Debug, P: Parser<'input, 'arena, TF> + Debug, P::Node: Debug, 'input: 'arena,

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'input, 'arena, TF, P> Default for DefaultErrorStrategy<'input, 'arena, TF, P>
where TF: TokenFactory<'input, 'arena> + 'arena, P: Parser<'input, 'arena, TF>, 'input: 'arena,

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<'input, 'arena, TF, P> ErrorStrategy<'input, 'arena, TF, P> for DefaultErrorStrategy<'input, 'arena, TF, P>
where TF: TokenFactory<'input, 'arena> + 'arena, P: Parser<'input, 'arena, TF>, 'input: 'arena,

Source§

fn reset(&mut self, recognizer: &mut P)

Reset the error handler state for the specified recognizer.
Source§

fn recover_inline( &mut self, recognizer: &mut P, ) -> Result<&'arena TF::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
Source§

fn recover( &mut self, recognizer: &mut P, _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.
Source§

fn sync(&mut self, recognizer: &mut P) -> 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
Source§

fn in_error_recovery_mode(&mut self, _recognizer: &mut P) -> 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
Source§

fn report_error(&mut self, recognizer: &mut P, e: &ANTLRError)

Report any kind of ANTLRError. This method is called by the default exception handler generated for a rule method.
Source§

fn report_match(&mut self, recognizer: &mut P)

This method is called when the parser successfully matches an input symbol.

Auto Trait Implementations§

§

impl<'input, 'arena, TF, P> Freeze for DefaultErrorStrategy<'input, 'arena, TF, P>

§

impl<'input, 'arena, TF, P> RefUnwindSafe for DefaultErrorStrategy<'input, 'arena, TF, P>
where <P as Recognizer<'input, 'arena>>::Node: RefUnwindSafe, TF: RefUnwindSafe, P: RefUnwindSafe,

§

impl<'input, 'arena, TF, P> Send for DefaultErrorStrategy<'input, 'arena, TF, P>
where <P as Recognizer<'input, 'arena>>::Node: Sync, TF: Send, P: Send,

§

impl<'input, 'arena, TF, P> Sync for DefaultErrorStrategy<'input, 'arena, TF, P>
where <P as Recognizer<'input, 'arena>>::Node: Sync, TF: Sync, P: Sync,

§

impl<'input, 'arena, TF, P> Unpin for DefaultErrorStrategy<'input, 'arena, TF, P>
where TF: Unpin, P: Unpin,

§

impl<'input, 'arena, TF, P> UnwindSafe for DefaultErrorStrategy<'input, 'arena, TF, P>
where <P as Recognizer<'input, 'arena>>::Node: RefUnwindSafe, TF: UnwindSafe, P: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.