Struct perplex_runtime::ParserMachine [−][src]
pub struct ParserMachine<I: ParserInput, S: StateSpace> { /* fields omitted */ }
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.
Methods
impl<I: ParserInput<Item = S::Terminal>, S: StateSpace> ParserMachine<I, S>
[src]
impl<I: ParserInput<Item = S::Terminal>, S: StateSpace> ParserMachine<I, S>
pub fn new(input: I) -> ParserMachine<I, S>
[src]
pub fn new(input: I) -> ParserMachine<I, S>
Create a new parser state machine.
pub fn run(self) -> S::Nonterminal
[src]
pub fn run(self) -> S::Nonterminal
Run the parser to completion.
impl<I: Iterator, S: StateSpace<Terminal = Option<I::Item>>> ParserMachine<IterInput<I>, S>
[src]
impl<I: Iterator, S: StateSpace<Terminal = Option<I::Item>>> ParserMachine<IterInput<I>, S>
pub fn from_iter(input: I) -> ParserMachine<IterInput<I>, S>
[src]
pub fn from_iter(input: I) -> ParserMachine<IterInput<I>, S>
Create a new parser state machine from an iterator.
Trait Implementations
impl<I, S> Parser for ParserMachine<I, S> where
I: ParserInput<Item = S::Terminal>,
S: StateSpace,
[src]
impl<I, S> Parser for ParserMachine<I, S> where
I: ParserInput<Item = S::Terminal>,
S: StateSpace,
type Terminal = S::Terminal
The type of terminals the parser emits.
type Nonterminal = S::Nonterminal
The type of nonterminals the parser emits. This is likely an enum over all nonterminals generated automatically. Read more
fn peek(&mut self) -> &S::Terminal
[src]
fn peek(&mut self) -> &S::Terminal
Peek at the next terminal in the sequence without shifting it.
fn shift(
&mut self,
state_fn: fn(_: &mut Self),
goto_fn: fn(_: &mut Self, _: S::Nonterminal)
)
[src]
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
fn goto(
&mut self,
nonterminal: S::Nonterminal,
state_fn: fn(_: &mut Self),
goto_fn: fn(_: &mut Self, _: S::Nonterminal)
)
[src]
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
fn reduce<F: Fn(Vec<Symbol<S::Terminal, S::Nonterminal>>) -> S::Nonterminal>(
&mut self,
length: usize,
f: F
)
[src]
fn reduce<F: Fn(Vec<Symbol<S::Terminal, S::Nonterminal>>) -> S::Nonterminal>(
&mut self,
length: usize,
f: F
)
Reduce the tail of the stack to a nonterminal. Read more
fn accept(&mut self)
[src]
fn accept(&mut self)
Accept the last symbol on the stack as the parse result. Read more
Auto Trait Implementations
impl<I, S> Send for ParserMachine<I, S> where
I: Send,
<S as StateSpace>::Nonterminal: Send,
<S as StateSpace>::Terminal: Send,
impl<I, S> Send for ParserMachine<I, S> where
I: Send,
<S as StateSpace>::Nonterminal: Send,
<S as StateSpace>::Terminal: Send,
impl<I, S> Sync for ParserMachine<I, S> where
I: Sync,
<S as StateSpace>::Nonterminal: Sync,
<S as StateSpace>::Terminal: Sync,
impl<I, S> Sync for ParserMachine<I, S> where
I: Sync,
<S as StateSpace>::Nonterminal: Sync,
<S as StateSpace>::Terminal: Sync,