pub struct TermParser<I>where
I: FusedIterator<Item = u8>,{ /* private fields */ }Implementations§
Source§impl<I> TermParser<I>where
I: FusedIterator<Item = u8>,
impl<I> TermParser<I>where
I: FusedIterator<Item = u8>,
pub fn try_new(input: I, opers: Option<OperDefs>) -> Result<Self>
pub fn try_collect_terms(&mut self, arena: &mut Arena) -> Result<Vec<Term>>
pub fn try_next_term(&mut self, arena: &mut Arena) -> Result<Option<Term>>
pub fn define_opers<J: FusedIterator<Item = u8>>( &mut self, arena: &mut Arena, defs_input: J, opers: Option<OperDefs>, ) -> Result<()>
Trait Implementations§
Source§impl<I> Parser<Arena> for TermParser<I>where
I: FusedIterator<Item = u8>,
impl<I> Parser<Arena> for TermParser<I>where
I: FusedIterator<Item = u8>,
Source§type Lexer = TermLexer<I>
type Lexer = TermLexer<I>
The lexer used by this parser.
Must be provided by the implementor and produce tokens compatible with
ParserData::TokenID.Source§type ParserData = ParData
type ParserData = ParData
The parser data providing states, productions, tokens, and lookup tables.
Must be provided by the implementor and be the struct generated by
parlex-gen’s parser generator, ASLR.
Source§fn ctx(&self) -> &ParserCtx<Self::Lexer, Self::ParserData, Arena>
fn ctx(&self) -> &ParserCtx<Self::Lexer, Self::ParserData, Arena>
Returns a shared reference to the parser context.
Must be provided by the implementor and return
&ParserCtx.Source§fn ctx_mut(&mut self) -> &mut ParserCtx<Self::Lexer, Self::ParserData, Arena>
fn ctx_mut(&mut self) -> &mut ParserCtx<Self::Lexer, Self::ParserData, Arena>
Returns a mutable reference to the parser context.
Must be provided by the implementor and return
&mut ParserCtx.Source§fn stats(&self) -> ParserStats
fn stats(&self) -> ParserStats
Returns current parser statistics.
Source§fn resolve_ambiguity(
&mut self,
_arena: &mut Arena,
ambig: AmbigID,
tok2: &TermToken,
) -> Result<Action>
fn resolve_ambiguity( &mut self, _arena: &mut Arena, ambig: AmbigID, tok2: &TermToken, ) -> Result<Action>
Resolves an ambiguity using user-defined logic (e.g., precedence/associativity).
Must be provided by the implementor.
Source§fn reduce(
&mut self,
arena: &mut Arena,
prod: ProdID,
token: &TermToken,
) -> Result<()>
fn reduce( &mut self, arena: &mut Arena, prod: ProdID, token: &TermToken, ) -> Result<()>
Performs a reduction for the specified production.
Must be provided by the implementor.
Source§fn tokens_peek<'a>(
&'a self,
index: usize,
) -> &'a <Self::Lexer as Lexer<U>>::Tokenwhere
U: 'a,
fn tokens_peek<'a>(
&'a self,
index: usize,
) -> &'a <Self::Lexer as Lexer<U>>::Tokenwhere
U: 'a,
Returns a reference to a token counted from the end of the stack.
0 = last (top), 1 = second last, etc. Read moreSource§fn tokens_mut_peek<'a>(
&'a mut self,
index: usize,
) -> &'a mut <Self::Lexer as Lexer<U>>::Tokenwhere
U: 'a,
fn tokens_mut_peek<'a>(
&'a mut self,
index: usize,
) -> &'a mut <Self::Lexer as Lexer<U>>::Tokenwhere
U: 'a,
Returns a mutable reference to a token counted from the end of the stack.
0 = last (top), 1 = second last, etc. Read moreSource§fn tokens_pop(&mut self) -> Result<<Self::Lexer as Lexer<U>>::Token, Error>
fn tokens_pop(&mut self) -> Result<<Self::Lexer as Lexer<U>>::Token, Error>
Pops and returns the last (top) token from the stack. Read more
Source§fn tokens_push(&mut self, token: <Self::Lexer as Lexer<U>>::Token)
fn tokens_push(&mut self, token: <Self::Lexer as Lexer<U>>::Token)
Pushes a token onto the stack.
Source§fn dump_state(&self, incoming: &<Self::Lexer as Lexer<U>>::Token)
fn dump_state(&self, incoming: &<Self::Lexer as Lexer<U>>::Token)
Traces the current parser state and token stack for debugging.
Formats the stack with states and tokens, marking the incoming token with
<-.Auto Trait Implementations§
impl<I> Freeze for TermParser<I>where
I: Freeze,
impl<I> RefUnwindSafe for TermParser<I>where
I: RefUnwindSafe,
impl<I> Send for TermParser<I>where
I: Send,
impl<I> Sync for TermParser<I>where
I: Sync,
impl<I> Unpin for TermParser<I>where
I: Unpin,
impl<I> UnwindSafe for TermParser<I>where
I: UnwindSafe,
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
Mutably borrows from an owned value. Read more