Enum gll_pg_core::SPPFNode
source · pub enum SPPFNode<L: GrammarLabel> {
Dummy,
Symbol(L::Symbol, usize, usize, Vec<SPPFNodeIndex>),
Intermediate(L, usize, usize, Vec<SPPFNodeIndex>),
Packed(L, usize, Vec<SPPFNodeIndex>),
}
Expand description
Binary SPPF Node structure.
Each node can be one of: Dummy, Symbol, Intermediate and Packed.
Symbol is a Terminal or a Nonterminal.
Intermediate is a grammar rule with position.
Packed means different derivations of the same grammar rule.
Each grammar rule possible position corresponds to a label. So store labels for Intermediate and Packed rules.
Variants§
Dummy
$ node in original paper
Symbol(L::Symbol, usize, usize, Vec<SPPFNodeIndex>)
(symbol, left, right, children)
Intermediate(L, usize, usize, Vec<SPPFNodeIndex>)
(label, left, right, children)
Packed(L, usize, Vec<SPPFNodeIndex>)
(label, split, children)
Implementations§
source§impl<L: GrammarLabel> SPPFNode<L>
impl<L: GrammarLabel> SPPFNode<L>
sourcepub fn right_extent(&self) -> usize
pub fn right_extent(&self) -> usize
Get right extent of the node, panics if it doesn’t have it.
sourcepub fn left_extent(&self) -> usize
pub fn left_extent(&self) -> usize
Get left extent of the node, panics if it doesn’t have it.
sourcepub fn children(&self) -> Option<&Vec<SPPFNodeIndex>>
pub fn children(&self) -> Option<&Vec<SPPFNodeIndex>>
Get children node references.
Trait Implementations§
source§impl<L: Ord + GrammarLabel> Ord for SPPFNode<L>
impl<L: Ord + GrammarLabel> Ord for SPPFNode<L>
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
source§impl<L: PartialEq + GrammarLabel> PartialEq for SPPFNode<L>
impl<L: PartialEq + GrammarLabel> PartialEq for SPPFNode<L>
source§impl<L: PartialOrd + GrammarLabel> PartialOrd for SPPFNode<L>where
L::Symbol: PartialOrd,
impl<L: PartialOrd + GrammarLabel> PartialOrd for SPPFNode<L>where
L::Symbol: PartialOrd,
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read moreimpl<L: Eq + GrammarLabel> Eq for SPPFNode<L>
impl<L: GrammarLabel> StructuralEq for SPPFNode<L>
impl<L: GrammarLabel> StructuralPartialEq for SPPFNode<L>
Auto Trait Implementations§
impl<L> RefUnwindSafe for SPPFNode<L>
impl<L> Send for SPPFNode<L>
impl<L> Sync for SPPFNode<L>
impl<L> Unpin for SPPFNode<L>
impl<L> UnwindSafe for SPPFNode<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
§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.