[][src]Struct lrtable::statetable::StateTable

pub struct StateTable<StorageT> {
    pub final_state: StIdx,
    // some fields omitted
}

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]

pub fn new(
    grm: &YaccGrammar<StorageT>,
    sg: &StateGraph<StorageT>
) -> Result<Self, StateTableError<StorageT>>
[src]

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>

Notable traits for StateActionsIterator<'a, StorageT>

impl<'a, StorageT: 'static + PrimInt + Unsigned> Iterator for StateActionsIterator<'a, StorageT> where
    usize: AsPrimitive<StorageT>, 
type Item = TIdx<StorageT>;
[src]

Return an iterator over the indexes of all non-empty actions of stidx.

pub fn state_shifts(&self, stidx: StIdx) -> StateActionsIterator<'_, StorageT>

Notable traits for StateActionsIterator<'a, StorageT>

impl<'a, StorageT: 'static + PrimInt + Unsigned> Iterator for StateActionsIterator<'a, StorageT> where
    usize: AsPrimitive<StorageT>, 
type Item = TIdx<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>

Notable traits for CoreReducesIterator<'a, StorageT>

impl<'a, StorageT: 'static + PrimInt + Unsigned> Iterator for CoreReducesIterator<'a, StorageT> where
    usize: AsPrimitive<StorageT>, 
type Item = PIdx<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

impl<StorageT> Send for StateTable<StorageT> where
    StorageT: Send

impl<StorageT> Sync for StateTable<StorageT> where
    StorageT: Sync

impl<StorageT> Unpin for StateTable<StorageT> where
    StorageT: Unpin

impl<StorageT> UnwindSafe for StateTable<StorageT> where
    StorageT: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Err = <U as TryFrom<T>>::Err