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>
impl<L: Ord + Clone + GrammarLabel> GSSState<L>
sourcepub fn add(&mut self, l: L, u: NodeIndex, i: usize, w: SPPFNodeIndex)
pub fn add(&mut self, l: L, u: NodeIndex, i: usize, w: SPPFNodeIndex)
The add
function in the paper
sourcepub fn pop(&mut self, u: NodeIndex, i: usize, z: SPPFNodeIndex)
pub fn pop(&mut self, u: NodeIndex, i: usize, z: SPPFNodeIndex)
The pop
function in the paper
sourcepub fn create(
&mut self,
l: L,
u: NodeIndex,
j: usize,
w: SPPFNodeIndex
) -> NodeIndex
pub fn create( &mut self, l: L, u: NodeIndex, j: usize, w: SPPFNodeIndex ) -> NodeIndex
The create
function in the paper
sourcepub fn get_node_t(&mut self, x: L::Symbol, i: usize) -> SPPFNodeIndex
pub fn get_node_t(&mut self, x: L::Symbol, i: usize) -> SPPFNodeIndex
The get_node_t
function in the paper
sourcepub fn get_node_p(
&mut self,
l: L,
w: SPPFNodeIndex,
z: SPPFNodeIndex
) -> SPPFNodeIndex
pub fn get_node_p( &mut self, l: L, w: SPPFNodeIndex, z: SPPFNodeIndex ) -> SPPFNodeIndex
The get_node_p
function in the paper
sourcepub fn collect_symbols(&self, node: SPPFNodeIndex) -> Vec<SPPFNodeIndex>
pub fn collect_symbols(&self, node: SPPFNodeIndex) -> Vec<SPPFNodeIndex>
Collect all symbol leaves of a packed node
sourcepub fn print_sppf_dot(&self) -> String
pub fn print_sppf_dot(&self) -> String
Print current SPPF graph in graphviz format
sourcepub fn print_gss_dot(&self) -> String
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>
impl<L> Sync for GSSState<L>
impl<L> Unpin for GSSState<L>
impl<L> UnwindSafe for GSSState<L>
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more