Struct parol::analysis::lookahead_dfa::LookaheadDFA
source · pub struct LookaheadDFA {
pub states: Vec<DFAState>,
pub transitions: BTreeMap<StateIndex, BTreeMap<TerminalIndex, StateIndex>>,
pub k: usize,
}
Expand description
The lookahead DFA. Used to calculate a certain production number from a sequence of terminals.
The start state is per definition always the state with index 0.
Fields§
§states: Vec<DFAState>
DFA states
transitions: BTreeMap<StateIndex, BTreeMap<TerminalIndex, StateIndex>>
The transitions data is the relation: “from-state -> terminal -> to-state” Actually a map of from-states to terminal transitions, which in turn are maps from terminals to to-states.
k: usize
Maximum number of tokens needed to reach an accepting state It is equivalent to the maximum length over all contributing k-tuples.
Implementations§
source§impl LookaheadDFA
impl LookaheadDFA
sourcepub fn from_k_tuples(k_tuples: &KTuples, prod_num: usize) -> Self
pub fn from_k_tuples(k_tuples: &KTuples, prod_num: usize) -> Self
Create a DFA from KTuples The idea is to convert lists of terminals into a trie data structure
Trait Implementations§
source§impl Clone for LookaheadDFA
impl Clone for LookaheadDFA
source§fn clone(&self) -> LookaheadDFA
fn clone(&self) -> LookaheadDFA
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for LookaheadDFA
impl Debug for LookaheadDFA
source§impl Default for LookaheadDFA
impl Default for LookaheadDFA
source§fn default() -> LookaheadDFA
fn default() -> LookaheadDFA
Returns the “default value” for a type. Read more
source§impl Display for LookaheadDFA
impl Display for LookaheadDFA
source§impl PartialEq for LookaheadDFA
impl PartialEq for LookaheadDFA
source§fn eq(&self, other: &LookaheadDFA) -> bool
fn eq(&self, other: &LookaheadDFA) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.impl Eq for LookaheadDFA
impl StructuralPartialEq for LookaheadDFA
Auto Trait Implementations§
impl Freeze for LookaheadDFA
impl RefUnwindSafe for LookaheadDFA
impl Send for LookaheadDFA
impl Sync for LookaheadDFA
impl Unpin for LookaheadDFA
impl UnwindSafe for LookaheadDFA
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<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.