[][src]Trait antlr_rust::ErrorStrategy

pub trait ErrorStrategy<'a, T: Parser<'a>>: Tid<'a> {
    fn reset(&mut self, recognizer: &mut T);
fn recover_inline(
        &mut self,
        recognizer: &mut T
    ) -> Result<<T::TF as TokenFactory<'a>>::Tok, ANTLRError>;
fn recover(
        &mut self,
        recognizer: &mut T,
        e: &ANTLRError
    ) -> Result<(), ANTLRError>;
fn sync(&mut self, recognizer: &mut T) -> Result<(), ANTLRError>;
fn in_error_recovery_mode(&mut self, recognizer: &mut T) -> bool;
fn report_error(&mut self, recognizer: &mut T, e: &ANTLRError);
fn report_match(&mut self, recognizer: &mut T); }

The interface for defining strategies to deal with syntax errors encountered during a parse by ANTLR-generated parsers. We distinguish between three different kinds of errors:

  • The parser could not figure out which path to take in the ATN (none of the available alternatives could possibly match)
  • The current input does not match what we were looking for
  • A predicate evaluated to false

Implementations of this interface report syntax errors by calling Parser.notifyErrorListeners

Required methods

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

fn recover_inline(
    &mut self,
    recognizer: &mut T
) -> Result<<T::TF as TokenFactory<'a>>::Tok, ANTLRError>

fn recover(
    &mut self,
    recognizer: &mut T,
    e: &ANTLRError
) -> Result<(), ANTLRError>

fn sync(&mut self, recognizer: &mut T) -> Result<(), ANTLRError>

fn in_error_recovery_mode(&mut self, recognizer: &mut T) -> bool

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

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

Loading content...

Implementations on Foreign Types

impl<'a, T: Parser<'a> + TidAble<'a>> ErrorStrategy<'a, T> for Box<dyn ErrorStrategy<'a, T> + 'a>[src]

Loading content...

Implementors

impl<'a, T: Parser<'a>> ErrorStrategy<'a, T> for BailErrorStrategy<'a, T::Node>[src]

impl<'a, T: Parser<'a>> ErrorStrategy<'a, T> for DefaultErrorStrategy<'a, T::Node>[src]

Loading content...