Struct lrpar::RTParserBuilder
source · [−]pub struct RTParserBuilder<'a, LexemeT: Lexeme<StorageT>, StorageT: Eq + Hash> { /* private fields */ }
Expand description
A run-time parser builder.
Implementations
sourceimpl<'a, LexemeT: Lexeme<StorageT>, StorageT: 'static + Debug + Hash + PrimInt + Unsigned> RTParserBuilder<'a, LexemeT, StorageT> where
usize: AsPrimitive<StorageT>,
impl<'a, LexemeT: Lexeme<StorageT>, StorageT: 'static + Debug + Hash + PrimInt + Unsigned> RTParserBuilder<'a, LexemeT, StorageT> where
usize: AsPrimitive<StorageT>,
sourcepub fn new(
grm: &'a YaccGrammar<StorageT>,
stable: &'a StateTable<StorageT>
) -> Self
pub fn new(
grm: &'a YaccGrammar<StorageT>,
stable: &'a StateTable<StorageT>
) -> Self
Create a new run-time parser from a YaccGrammar
, and a StateTable
.
sourcepub fn recoverer(self, rk: RecoveryKind) -> Self
pub fn recoverer(self, rk: RecoveryKind) -> Self
Set the recoverer for this parser to rk
.
pub fn term_costs(self, f: &'a dyn Fn(TIdx<StorageT>) -> u8) -> Self
sourcepub fn parse_generictree(
&self,
lexer: &dyn NonStreamingLexer<'_, LexemeT, StorageT>
) -> (Option<Node<LexemeT, StorageT>>, Vec<LexParseError<LexemeT, StorageT>>)
pub fn parse_generictree(
&self,
lexer: &dyn NonStreamingLexer<'_, LexemeT, StorageT>
) -> (Option<Node<LexemeT, StorageT>>, Vec<LexParseError<LexemeT, StorageT>>)
Parse input, and (if possible) return a generic parse tree. See the arguments for
parse_actions
for more details about the return value.
sourcepub fn parse_noaction(
&self,
lexer: &dyn NonStreamingLexer<'_, LexemeT, StorageT>
) -> Vec<LexParseError<LexemeT, StorageT>>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A> where
A: Allocator,
pub fn parse_noaction(
&self,
lexer: &dyn NonStreamingLexer<'_, LexemeT, StorageT>
) -> Vec<LexParseError<LexemeT, StorageT>>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A> where
A: Allocator,
A: Allocator,
Parse input, returning any errors found. See the arguments for
parse_actions
for more details about the return value.
sourcepub fn parse_actions<'b: 'a, 'input: 'b, ActionT: 'a, ParamT: Copy>(
&self,
lexer: &'b dyn NonStreamingLexer<'input, LexemeT, StorageT>,
actions: &'a [&'a dyn Fn(RIdx<StorageT>, &'b dyn NonStreamingLexer<'input, LexemeT, StorageT>, Span, Drain<'_, AStackType<LexemeT, ActionT>>, ParamT) -> ActionT],
param: ParamT
) -> (Option<ActionT>, Vec<LexParseError<LexemeT, StorageT>>)
pub fn parse_actions<'b: 'a, 'input: 'b, ActionT: 'a, ParamT: Copy>(
&self,
lexer: &'b dyn NonStreamingLexer<'input, LexemeT, StorageT>,
actions: &'a [&'a dyn Fn(RIdx<StorageT>, &'b dyn NonStreamingLexer<'input, LexemeT, StorageT>, Span, Drain<'_, AStackType<LexemeT, ActionT>>, ParamT) -> ActionT],
param: ParamT
) -> (Option<ActionT>, Vec<LexParseError<LexemeT, StorageT>>)
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, LexemeT, StorageT> !RefUnwindSafe for RTParserBuilder<'a, LexemeT, StorageT>
impl<'a, LexemeT, StorageT> !Send for RTParserBuilder<'a, LexemeT, StorageT>
impl<'a, LexemeT, StorageT> !Sync for RTParserBuilder<'a, LexemeT, StorageT>
impl<'a, LexemeT, StorageT> Unpin for RTParserBuilder<'a, LexemeT, StorageT> where
LexemeT: Unpin,
StorageT: Unpin,
impl<'a, LexemeT, StorageT> !UnwindSafe for RTParserBuilder<'a, LexemeT, StorageT>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more