Module rustlr::runtime_parser
source · [−]Expand description
This module is deprecated by the crate::zc_parser module and is only kept for compatibility with existing parsers.
This module implements the parsing routines that uses the state machine generated by rustlr. The main structure here is RuntimeParser. All parsing functions are organized around the RuntimeParser::parse_base function, which implements the basic LR parsing algorithm. This function expects dynamic Lexer and ErrHandler trait-objects. This module provides generic parsing and parser-training routines that use stdio for interface, but the ErrHandler trait allows custom user interfaces to be build separately.
Structs
this structure is only exported because it is required by the generated parsers. There is no reason to use it in other programs.
this is the structure created by the generated parser. The generated parser program will contain a make_parser function that returns this structure. Most of the pub items are, however, only exported to support the operation of the parser, and should not be accessed directly. Only the functions RuntimeParser::parse, RuntimeParser::report, RuntimeParser::abort and RuntimeParser::error_occurred should be called directly from user programs. Only the field RuntimeParser::exstate should be accessed by user programs.
these objects implement the ErrHandler trait. They are used in the RuntimeParser::parse_stdio, RuntimeParser::parse_stdio_train and RuntimeParser::train_from_script functions.
Traits
A trait object that implements ErrHandler is expected by the RuntimeParser::parse_base function, which implements the basic LR parsing algorithm using the generated state machine. The struct StandardReporter is provided as the default ErrHandler 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.