Parser

Struct Parser 

Source
pub struct Parser<'a> { /* private fields */ }

Implementations§

Source§

impl<'a> Parser<'a>

Source

pub const MAX_NBR_RECOVERS: u32 = 5u32

Maximum number of error recoveries attempted when meeting a syntax error

Source

pub const MAX_NBR_LEXER_ERRORS: u32 = 3u32

Source

pub fn new( num_nt: usize, num_t: usize, alt_var: &'a [VarId], alts: Vec<Alternative>, opcodes: Vec<Vec<OpCode>>, table: &'a [AltId], symbol_table: FixedSymTable, start: VarId, ) -> Self

Source

pub fn get_symbol_table(&self) -> Option<&FixedSymTable>

Source

pub fn set_start(&mut self, start: VarId)

Source

pub fn set_try_recover(&mut self, try_recover: bool)

Source

pub fn parse_stream<I, L>( &mut self, wrapper: &mut L, stream: I, ) -> Result<(), ParserError>
where I: Iterator<Item = ParserToken>, L: ListenerWrapper,

Parses an entire stream using the listener, and returns Ok(()) if the whole stream could be successfully parsed, or an error if it couldn’t.

All errors are reported to the wrapper’s log. Usually, the wrapper simply transmits the reports to the user listener’s log, where the user listener is embedded in the wrapper as one of its fields and is defined by the user (instead of being generated like the wrapper).

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> UnwindSafe for Parser<'a>

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

Source§

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

Source§

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.