Struct lrtable::StateGraph
source · Implementations
sourceimpl<StorageT: 'static + Hash + PrimInt + Unsigned> StateGraph<StorageT>where
usize: AsPrimitive<StorageT>,
impl<StorageT: 'static + Hash + PrimInt + Unsigned> StateGraph<StorageT>where
usize: AsPrimitive<StorageT>,
sourcepub fn iter_stidxs(&self) -> Box<dyn Iterator<Item = StIdx>>
pub fn iter_stidxs(&self) -> Box<dyn Iterator<Item = StIdx>>
Return an iterator which produces (in order from 0..self.rules_len()
) all this
grammar’s valid RIdx
s.
sourcepub fn closed_state(&self, stidx: StIdx) -> &Itemset<StorageT>
pub fn closed_state(&self, stidx: StIdx) -> &Itemset<StorageT>
Return the itemset for closed state stidx
. Panics if stidx
doesn’t exist.
sourcepub fn iter_closed_states<'a>(
&'a self
) -> Box<dyn Iterator<Item = &'a Itemset<StorageT>> + 'a>
pub fn iter_closed_states<'a>(
&'a self
) -> Box<dyn Iterator<Item = &'a Itemset<StorageT>> + 'a>
Return an iterator over all closed states in this StateGraph
.
sourcepub fn core_state(&self, stidx: StIdx) -> &Itemset<StorageT>
pub fn core_state(&self, stidx: StIdx) -> &Itemset<StorageT>
Return the itemset for core state stidx
or None
if it doesn’t exist.
sourcepub fn iter_core_states<'a>(
&'a self
) -> Box<dyn Iterator<Item = &'a Itemset<StorageT>> + 'a>
pub fn iter_core_states<'a>(
&'a self
) -> Box<dyn Iterator<Item = &'a Itemset<StorageT>> + 'a>
Return an iterator over all core states in this StateGraph
.
sourcepub fn all_states_len(&self) -> StIdx
pub fn all_states_len(&self) -> StIdx
How many states does this StateGraph
contain? NB: By definition the StateGraph
contains
the same number of core and closed states.
sourcepub fn edge(&self, stidx: StIdx, sym: Symbol<StorageT>) -> Option<StIdx>
pub fn edge(&self, stidx: StIdx, sym: Symbol<StorageT>) -> Option<StIdx>
Return the state pointed to by sym
from stidx
or None
otherwise.
sourcepub fn edges(&self, stidx: StIdx) -> &HashMap<Symbol<StorageT>, StIdx>
pub fn edges(&self, stidx: StIdx) -> &HashMap<Symbol<StorageT>, StIdx>
Return the edges for state stidx
. Panics if stidx
doesn’t exist.
sourcepub fn all_edges_len(&self) -> usize
pub fn all_edges_len(&self) -> usize
How many edges does this StateGraph
contain?
sourcepub fn pp(&self, grm: &YaccGrammar<StorageT>, core_states: bool) -> String
pub fn pp(&self, grm: &YaccGrammar<StorageT>, core_states: bool) -> String
Pretty print this stategraph as a String
. If core_states
is set to true, only the core
states are pretty printed; if set to false, all states (including non-core states) are
pretty printed.
sourcepub fn pp_core_states(&self, grm: &YaccGrammar<StorageT>) -> String
pub fn pp_core_states(&self, grm: &YaccGrammar<StorageT>) -> String
Return a pretty printed version of the core states, and all edges.
sourcepub fn pp_closed_states(&self, grm: &YaccGrammar<StorageT>) -> String
pub fn pp_closed_states(&self, grm: &YaccGrammar<StorageT>) -> String
Return a pretty printed version of the closed states, and all edges.