pub struct Parser<'a> { /* private fields */ }Expand description
Parser object. The new(…) method creates a new instance.
Implementations§
Source§impl<'a> Parser<'a>
impl<'a> Parser<'a>
Sourcepub const MAX_NBR_RECOVERS: u32 = 5
pub const MAX_NBR_RECOVERS: u32 = 5
Maximum number of error recoveries attempted when meeting a syntax error
pub const MAX_NBR_LEXER_ERRORS: u32 = 3
pub fn new( num_nt: usize, num_t: usize, alt_var: &'a [u16], alts: Vec<Alternative>, opcodes: Vec<Vec<OpCode>>, init_opcodes: Vec<OpCode>, table: &'a [u16], symbol_table: FixedSymTable, start: u16, ) -> Parser<'a>
Sourcepub fn get_symbol_table(&self) -> Option<&FixedSymTable>
pub fn get_symbol_table(&self) -> Option<&FixedSymTable>
Gets a reference to the symbol table, if one is attached.
Sourcepub fn set_start(&mut self, start: u16)
pub fn set_start(&mut self, start: u16)
Sets the top nonterminal. The parser ends the parsing once the corresponding rule has been entirely parsed.
Sourcepub fn set_try_recover(&mut self, try_recover: bool)
pub fn set_try_recover(&mut self, try_recover: bool)
Enables or disables the recovery from syntactic or lexical errors.
See also ParserError::TooManyErrors and ParserError::SyntaxError.
Sourcepub fn parse_stream<I, L>(
&mut self,
wrapper: &mut L,
stream: I,
) -> Result<(), ParserError>
pub fn parse_stream<I, L>( &mut self, wrapper: &mut L, stream: I, ) -> Result<(), ParserError>
Parses the entire stream, calling the (listener) wrapper with the
actions that correspond to the parser events.
Returns Ok(()) if the whole stream could be successfully parsed, or an
error if it couldn’t.
All errors are reported in the wrapper’s log. Usually, the wrapper simply transmits the reports to the user listener’s log (done in the generated code).
Auto Trait Implementations§
impl<'a> Freeze for Parser<'a>
impl<'a> RefUnwindSafe for Parser<'a>
impl<'a> Send for Parser<'a>
impl<'a> Sync for Parser<'a>
impl<'a> Unpin for Parser<'a>
impl<'a> UnsafeUnpin for Parser<'a>
impl<'a> UnwindSafe for Parser<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<S> BuildFrom<S> for S
impl<S> BuildFrom<S> for S
Source§fn build_from(source: S) -> S
fn build_from(source: S) -> S
Source§impl<S, T> BuildInto<T> for Swhere
T: BuildFrom<S>,
impl<S, T> BuildInto<T> for Swhere
T: BuildFrom<S>,
Source§fn build_into(self) -> T
fn build_into(self) -> T
Calls T::from(self) to convert a S into a T.