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: PartialOrd + GrammarLabel> PartialOrd for SPPFNode<L>where
L::Symbol: PartialOrd,
impl<L: PartialOrd + GrammarLabel> PartialOrd for SPPFNode<L>where
L::Symbol: PartialOrd,
impl<L: Eq + GrammarLabel> Eq for SPPFNode<L>
impl<L: GrammarLabel> StructuralPartialEq for SPPFNode<L>
Auto Trait Implementations§
impl<L> Freeze for SPPFNode<L>
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.