pub struct ParserMachine<I: ParserInput, S: StateSpace> { /* private fields */ }
Expand description
A parser state machine.
This struct implements the parse stack and driver for the parser. It is generic over the means by which terminals arrive at the input.
Implementations§
Source§impl<I: ParserInput<Item = S::Terminal>, S: StateSpace> ParserMachine<I, S>
impl<I: ParserInput<Item = S::Terminal>, S: StateSpace> ParserMachine<I, S>
Sourcepub fn new(input: I) -> ParserMachine<I, S>
pub fn new(input: I) -> ParserMachine<I, S>
Create a new parser state machine.
Sourcepub fn run(self) -> S::Nonterminal
pub fn run(self) -> S::Nonterminal
Run the parser to completion.
Source§impl<I: Iterator, S: StateSpace<Terminal = Option<I::Item>>> ParserMachine<IterInput<I>, S>
impl<I: Iterator, S: StateSpace<Terminal = Option<I::Item>>> ParserMachine<IterInput<I>, S>
Sourcepub fn from_iter(input: I) -> ParserMachine<IterInput<I>, S>
pub fn from_iter(input: I) -> ParserMachine<IterInput<I>, S>
Create a new parser state machine from an iterator.
Trait Implementations§
Source§impl<I, S> Parser for ParserMachine<I, S>
impl<I, S> Parser for ParserMachine<I, S>
Source§type Terminal = <S as StateSpace>::Terminal
type Terminal = <S as StateSpace>::Terminal
The type of terminals the parser emits.
Source§type Nonterminal = <S as StateSpace>::Nonterminal
type Nonterminal = <S as StateSpace>::Nonterminal
The type of nonterminals the parser emits. This is likely an enum over
all nonterminals generated automatically.
Source§fn peek(&mut self) -> &S::Terminal
fn peek(&mut self) -> &S::Terminal
Peek at the next terminal in the sequence without shifting it.
Source§fn shift(
&mut self,
state_fn: fn(_: &mut Self),
goto_fn: fn(_: &mut Self, _: S::Nonterminal),
)
fn shift( &mut self, state_fn: fn(_: &mut Self), goto_fn: fn(_: &mut Self, _: S::Nonterminal), )
Push the next terminal onto the stack. Read more
Source§fn goto(
&mut self,
nonterminal: S::Nonterminal,
state_fn: fn(_: &mut Self),
goto_fn: fn(_: &mut Self, _: S::Nonterminal),
)
fn goto( &mut self, nonterminal: S::Nonterminal, state_fn: fn(_: &mut Self), goto_fn: fn(_: &mut Self, _: S::Nonterminal), )
Push a nonterminal onto the stack. Read more
Auto Trait Implementations§
impl<I, S> Freeze for ParserMachine<I, S>
impl<I, S> RefUnwindSafe for ParserMachine<I, S>where
I: RefUnwindSafe,
<S as StateSpace>::Nonterminal: RefUnwindSafe,
<S as StateSpace>::Terminal: RefUnwindSafe,
impl<I, S> Send for ParserMachine<I, S>
impl<I, S> Sync for ParserMachine<I, S>
impl<I, S> Unpin for ParserMachine<I, S>
impl<I, S> UnwindSafe for ParserMachine<I, S>where
I: UnwindSafe,
<S as StateSpace>::Nonterminal: UnwindSafe,
<S as StateSpace>::Terminal: 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