Trait rustlr::zc_parser::ErrReporter

source ·
pub trait ErrReporter<AT: Default, ET: Default> {
    // Required method
    fn err_reporter(
        &mut self,
        parser: &mut ZCParser<AT, ET>,
        lookahead: &TerminalToken<'_, AT>,
        erropt: &Option<Stateaction>,
        tokenizer: &dyn Tokenizer<'_, AT>
    );

    // Provided method
    fn report_err(&self, parser: &mut ZCParser<AT, ET>, msg: &str) { ... }
}
Expand description

A trait object that implements ErrReporter is expected by the ZCParser::parse_core function, which implements the basic LR parsing algorithm using the generated state machine. The struct StandardReporter is provided as the default ErrReporter that uses standard I/O as interface and has the ability to train the parser. But other implementations of the trait can be created that use different interfaces, such as a graphical IDE.

This trait replaces crate::ErrHandler in the crate::runtime_parser module.

Required Methods§

source

fn err_reporter( &mut self, parser: &mut ZCParser<AT, ET>, lookahead: &TerminalToken<'_, AT>, erropt: &Option<Stateaction>, tokenizer: &dyn Tokenizer<'_, AT> )

Provided Methods§

source

fn report_err(&self, parser: &mut ZCParser<AT, ET>, msg: &str)

Implementors§