[−][src]Struct lrtable::statetable::StateTable
A representation of a StateTable
for a grammar. actions
and gotos
are split into two
separate hashmaps, rather than a single table, due to the different types of their values.
Fields
final_state: StIdx
Implementations
impl<StorageT: 'static + Hash + PrimInt + Unsigned> StateTable<StorageT> where
usize: AsPrimitive<StorageT>,
u32: AsPrimitive<StorageT>,
[src]
usize: AsPrimitive<StorageT>,
u32: AsPrimitive<StorageT>,
pub fn new(
grm: &YaccGrammar<StorageT>,
sg: &StateGraph<StorageT>
) -> Result<Self, StateTableError<StorageT>>
[src]
grm: &YaccGrammar<StorageT>,
sg: &StateGraph<StorageT>
) -> Result<Self, StateTableError<StorageT>>
pub fn action(&self, stidx: StIdx, tidx: TIdx<StorageT>) -> Action<StorageT>
[src]
Return the action for stidx
and sym
, or None
if there isn't any.
pub fn state_actions(&self, stidx: StIdx) -> StateActionsIterator<StorageT>
[src]
Return an iterator over the indexes of all non-empty actions of stidx
.
pub fn state_shifts(&self, stidx: StIdx) -> StateActionsIterator<StorageT>
[src]
Return an iterator over the indexes of all shift actions of stidx
. By definition this
is a subset of the indexes produced by state_actions
.
pub fn reduce_only_state(&self, stidx: StIdx) -> bool
[src]
Does the state stidx
1) only contain reduce (and error) actions 2) do those
reductions all reduce to the same production?
pub fn core_reduces(&self, stidx: StIdx) -> CoreReducesIterator<StorageT>
[src]
Return an iterator over a set of "core" reduces of stidx
. This is a minimal set of
reduce actions which explore all possible reductions from a given state. Note that these
are chosen non-deterministically from a set of equivalent reduce actions: you must not rely
on always seeing the same reduce actions. For example if a state has these three items:
[E -> a ., $] [E -> b ., $] [F -> c ., $]
then the core reduces will be:
One of: [E -> a., $] or [E -> b., $] And: [F -> c., $]
since the two [E -> ...] items both have the same effects on a parse stack.
pub fn goto(&self, stidx: StIdx, ridx: RIdx<StorageT>) -> Option<StIdx>
[src]
Return the goto state for stidx
and ridx
, or None
if there isn't any.
pub fn start_state(&self) -> StIdx
[src]
Return this state table's start state.
pub fn conflicts(&self) -> Option<&Conflicts<StorageT>>
[src]
Return a struct containing all conflicts or None
if there aren't any.
Auto Trait Implementations
impl<StorageT> RefUnwindSafe for StateTable<StorageT> where
StorageT: RefUnwindSafe,
StorageT: RefUnwindSafe,
impl<StorageT> Send for StateTable<StorageT> where
StorageT: Send,
StorageT: Send,
impl<StorageT> Sync for StateTable<StorageT> where
StorageT: Sync,
StorageT: Sync,
impl<StorageT> Unpin for StateTable<StorageT> where
StorageT: Unpin,
StorageT: Unpin,
impl<StorageT> UnwindSafe for StateTable<StorageT> where
StorageT: UnwindSafe,
StorageT: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,