lrpar

Struct RTParserBuilder

source
pub struct RTParserBuilder<'a, StorageT: 'static + Eq + Debug + Hash + PrimInt + Unsigned, LexerTypesT: LexerTypes<StorageT = StorageT>>
where usize: AsPrimitive<StorageT>,
{ /* private fields */ }
Expand description

A run-time parser builder.

Implementations§

source§

impl<'a, StorageT: 'static + Debug + Hash + PrimInt + Unsigned, LexerTypesT: LexerTypes<StorageT = StorageT>> RTParserBuilder<'a, StorageT, LexerTypesT>
where usize: AsPrimitive<StorageT>,

source

pub fn new( grm: &'a YaccGrammar<StorageT>, stable: &'a StateTable<StorageT>, ) -> Self

Create a new run-time parser from a YaccGrammar, and a StateTable.

source

pub fn recoverer(self, rk: RecoveryKind) -> Self

Set the recoverer for this parser to rk.

source

pub fn term_costs(self, f: &'a dyn Fn(TIdx<StorageT>) -> u8) -> Self

source

pub fn parse_generictree( &self, lexer: &dyn NonStreamingLexer<'_, LexerTypesT>, ) -> (Option<Node<LexerTypesT::LexemeT, StorageT>>, Vec<LexParseError<StorageT, LexerTypesT>>)

Parse input, and (if possible) return a generic parse tree. See the arguments for parse_actions for more details about the return value.

source

pub fn parse_noaction( &self, lexer: &dyn NonStreamingLexer<'_, LexerTypesT>, ) -> Vec<LexParseError<StorageT, LexerTypesT>>

Parse input, returning any errors found. See the arguments for parse_actions for more details about the return value.

source

pub fn parse_actions<'b: 'a, 'input: 'b, ActionT: 'a, ParamT: Clone>( &self, lexer: &'b dyn NonStreamingLexer<'input, LexerTypesT>, actions: &'a [&'a dyn Fn(RIdx<StorageT>, &'b dyn NonStreamingLexer<'input, LexerTypesT>, Span, Drain<'_, AStackType<<LexerTypesT as LexerTypes>::LexemeT, ActionT>>, ParamT) -> ActionT], param: ParamT, ) -> (Option<ActionT>, Vec<LexParseError<StorageT, LexerTypesT>>)

Parse input, execute actions, and return the associated value (if possible) and/or any lexing/parsing errors encountered. Note that the two parts of the (value, errors) return pair are entirely independent: one can encounter errors without a value being produced (None, [...]), errors and a value (Some(...), [...]), as well as a value and no errors (Some(...), []). Errors are sorted by the position they were found in the input and can be a mix of lexing and parsing errors.

Auto Trait Implementations§

§

impl<'a, StorageT, LexerTypesT> Freeze for RTParserBuilder<'a, StorageT, LexerTypesT>
where usize: Sized,

§

impl<'a, StorageT, LexerTypesT> !RefUnwindSafe for RTParserBuilder<'a, StorageT, LexerTypesT>

§

impl<'a, StorageT, LexerTypesT> !Send for RTParserBuilder<'a, StorageT, LexerTypesT>

§

impl<'a, StorageT, LexerTypesT> !Sync for RTParserBuilder<'a, StorageT, LexerTypesT>

§

impl<'a, StorageT, LexerTypesT> Unpin for RTParserBuilder<'a, StorageT, LexerTypesT>
where usize: Sized, StorageT: Unpin, LexerTypesT: Unpin,

§

impl<'a, StorageT, LexerTypesT> !UnwindSafe for RTParserBuilder<'a, StorageT, LexerTypesT>

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.