lrtable

Struct StateGraph

source
pub struct StateGraph<StorageT: Eq + Hash> { /* private fields */ }

Implementations§

source§

impl<StorageT: 'static + Hash + PrimInt + Unsigned> StateGraph<StorageT>
where usize: AsPrimitive<StorageT>,

source

pub fn start_state(&self) -> StIdx<StorageT>

Return this state graph’s start state.

source

pub fn iter_stidxs(&self) -> Box<dyn Iterator<Item = StIdx<StorageT>>>

Return an iterator which produces (in order from StorageT::zero()..self.all_states_len()) all this grammar’s valid StIdxs.

source

pub fn closed_state(&self, stidx: StIdx<StorageT>) -> &Itemset<StorageT>

Return the itemset for closed state stidx. Panics if stidx doesn’t exist.

source

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.

source

pub fn core_state(&self, stidx: StIdx<StorageT>) -> &Itemset<StorageT>

Return the itemset for core state stidx or None if it doesn’t exist.

source

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.

source

pub fn all_states_len(&self) -> StIdx<StorageT>

How many states does this StateGraph contain? NB: By definition the StateGraph contains the same number of core and closed states.

source

pub fn edge( &self, stidx: StIdx<StorageT>, sym: Symbol<StorageT>, ) -> Option<StIdx<StorageT>>

Return the state pointed to by sym from stidx or None otherwise.

source

pub fn edges( &self, stidx: StIdx<StorageT>, ) -> &HashMap<Symbol<StorageT>, StIdx<StorageT>>

Return the edges for state stidx. Panics if stidx doesn’t exist.

source

pub fn all_edges_len(&self) -> usize

How many edges does this StateGraph contain?

source

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.

source

pub fn pp_core_states(&self, grm: &YaccGrammar<StorageT>) -> String

Return a pretty printed version of the core states, and all edges.

source

pub fn pp_closed_states(&self, grm: &YaccGrammar<StorageT>) -> String

Return a pretty printed version of the closed states, and all edges.

Trait Implementations§

source§

impl<StorageT: Debug + Eq + Hash> Debug for StateGraph<StorageT>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<StorageT> Freeze for StateGraph<StorageT>
where StorageT: Freeze,

§

impl<StorageT> RefUnwindSafe for StateGraph<StorageT>
where StorageT: RefUnwindSafe,

§

impl<StorageT> Send for StateGraph<StorageT>
where StorageT: Send,

§

impl<StorageT> Sync for StateGraph<StorageT>
where StorageT: Sync,

§

impl<StorageT> Unpin for StateGraph<StorageT>
where StorageT: Unpin,

§

impl<StorageT> UnwindSafe for StateGraph<StorageT>
where StorageT: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

source§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

source§

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

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.