Struct rustlr::runtime_parser::StandardReporter

source ·
pub struct StandardReporter {
    pub training: bool,
    pub trained: HashMap<(usize, String), String>,
    pub scriptinopt: Option<BufReader<File>>,
    pub scriptoutopt: Option<File>,
}
Expand description

these objects implement the ErrHandler trait. They are used in the RuntimeParser::parse_stdio, RuntimeParser::parse_stdio_train and RuntimeParser::train_from_script functions.

Fields§

§training: bool§trained: HashMap<(usize, String), String>§scriptinopt: Option<BufReader<File>>§scriptoutopt: Option<File>

Implementations§

source§

impl StandardReporter

source

pub fn new() -> StandardReporter

creates default standard reporter, used by parse_stdio (does not train)

source

pub fn new_interactive_training(existingparser: &str) -> StandardReporter

creates a stdio error handler with interactive training, takes as argument parser file name, to create script for future retraining.

source

pub fn new_script_training( existingparser: &str, scriptfile: &str ) -> StandardReporter

creates a stdio error handler that trains (non-interactively) from a previously created script. It’s the user’s responsibility to match the script file with the input source.

source§

impl StandardReporter

source

pub fn augment_training(&mut self, filepath: &str) -> Result<()>

Trait Implementations§

source§

impl<AT: Default, ET: Default> ErrHandler<AT, ET> for StandardReporter

source§

fn err_reporter( &mut self, parser: &mut RuntimeParser<AT, ET>, lookahead: &Lextoken<AT>, erropt: &Option<Stateaction> )

source§

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

source§

impl<'t, AT: Default, ET: Default, TT: Tokenizer<'t, AT>> ErrReportMaker<'t, AT, ET, TT> for StandardReporter

source§

fn err_reporter( &mut self, parser: &mut BaseParser<'t, AT, ET, TT>, lookahead: &TerminalToken<'_, AT>, erropt: &Option<Stateaction> )

source§

fn report_err(&self, parser: &mut BaseParser<'t, AT, ET, TT>, msg: &str)

source§

impl<AT: Default, ET: Default> ErrReporter<AT, ET> for StandardReporter

source§

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

source§

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

Auto Trait Implementations§

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>,

§

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>,

§

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.