Struct gll_pg_core::GSSState

source ·
pub struct GSSState<L: Ord + Clone + GrammarLabel> {
    pub graph: Graph<GSSNode<L>, SPPFNodeIndex, Directed>,
    pub nodes: BTreeMap<GSSNode<L>, NodeIndex>,
    pub sppf_nodes: Vec<SPPFNode<L>>,
    pub initial_node_index: NodeIndex,
    pub visited: Vec<BTreeSet<(L, NodeIndex, SPPFNodeIndex)>>,
    pub todo: Vec<(L, NodeIndex, usize, SPPFNodeIndex)>,
    pub pop: BTreeSet<(NodeIndex, SPPFNodeIndex)>,
    pub current_position: usize,
    pub current_node_index: NodeIndex,
    pub current_sppf_node: usize,
}
Expand description

All GSS Parser states. It is used by generated code, don’t use it directly.

Fields§

§graph: Graph<GSSNode<L>, SPPFNodeIndex, Directed>

Direct GSS graph

§nodes: BTreeMap<GSSNode<L>, NodeIndex>

Mapping from node to its index

§sppf_nodes: Vec<SPPFNode<L>>

All sppf nodes, and nodes reference each other by index

§initial_node_index: NodeIndex§visited: Vec<BTreeSet<(L, NodeIndex, SPPFNodeIndex)>>

U_j in original paper

§todo: Vec<(L, NodeIndex, usize, SPPFNodeIndex)>

R in original paper

§pop: BTreeSet<(NodeIndex, SPPFNodeIndex)>

P in original paper

§current_position: usize

C_i in original paper

§current_node_index: NodeIndex

C_u in original paper

§current_sppf_node: usize

C_n in original paper

Implementations§

source§

impl<L: Ord + Clone + GrammarLabel> GSSState<L>

source

pub fn add(&mut self, l: L, u: NodeIndex, i: usize, w: SPPFNodeIndex)

The add function in the paper

source

pub fn pop(&mut self, u: NodeIndex, i: usize, z: SPPFNodeIndex)

The pop function in the paper

source

pub fn create( &mut self, l: L, u: NodeIndex, j: usize, w: SPPFNodeIndex ) -> NodeIndex

The create function in the paper

source

pub fn get_node_t(&mut self, x: L::Symbol, i: usize) -> SPPFNodeIndex

The get_node_t function in the paper

source

pub fn get_node_p( &mut self, l: L, w: SPPFNodeIndex, z: SPPFNodeIndex ) -> SPPFNodeIndex

The get_node_p function in the paper

source

pub fn collect_symbols(&self, node: SPPFNodeIndex) -> Vec<SPPFNodeIndex>

Collect all symbol leaves of a packed node

source

pub fn print_sppf_dot(&self) -> String

Print current SPPF graph in graphviz format

source

pub fn print_gss_dot(&self) -> String

Print current GSS graph in graphviz format

Auto Trait Implementations§

§

impl<L> RefUnwindSafe for GSSState<L>

§

impl<L> Send for GSSState<L>
where L: Send, <L as GrammarLabel>::Symbol: Send,

§

impl<L> Sync for GSSState<L>
where L: Sync, <L as GrammarLabel>::Symbol: Sync,

§

impl<L> Unpin for GSSState<L>
where L: Unpin, <L as GrammarLabel>::Symbol: Unpin,

§

impl<L> UnwindSafe for GSSState<L>

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>,

§

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>,

§

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.