pub struct Parser<I: Clone + Ord> { /* private fields */ }Expand description
Nondeterministic finite automata with epsilon transitions.
Implementations§
source§impl<I: Clone + Ord> Graph<I>
impl<I: Clone + Ord> Graph<I>
sourcepub fn unit(singleton: I, fn_name: Option<&'static str>) -> Self
pub fn unit(singleton: I, fn_name: Option<&'static str>) -> Self
NFA accepting this exact token and only this exact token, only once.
sourcepub fn take_all_epsilon_transitions(&self, queue: Vec<usize>) -> BTreeSet<usize>
pub fn take_all_epsilon_transitions(&self, queue: Vec<usize>) -> BTreeSet<usize>
Take every transition that doesn’t require input.
sourcepub fn accept<Iter: IntoIterator>(&self, iter: Iter) -> boolwhere
Iter::Item: Borrow<I>,
pub fn accept<Iter: IntoIterator>(&self, iter: Iter) -> boolwhere Iter::Item: Borrow<I>,
Decide whether an input belongs to the regular langage this NFA accepts.
sourcepub fn reject<Iter: IntoIterator<Item = I>>(&self, iter: Iter) -> bool
pub fn reject<Iter: IntoIterator<Item = I>>(&self, iter: Iter) -> bool
Decide whether an input belongs to the regular langage this NFA accepts.
sourcepub fn fuzz(&self) -> Result<Fuzzer<I>, NeverAccepts>
pub fn fuzz(&self) -> Result<Fuzzer<I>, NeverAccepts>
Randomly generate inputs that are all guaranteed to be accepted.
NOTE: returns an infinite iterator! for input in automaton.fuzz()? will loop forever . . .
Errors
If this automaton never accepts any input.
sourcepub fn would_ever_accept(&self) -> bool
pub fn would_ever_accept(&self) -> bool
Check if there exists a string this DFA will accept.
Trait Implementations§
source§impl<I: Ord + Clone + Ord> Ord for Graph<I>
impl<I: Ord + Clone + Ord> Ord for Graph<I>
source§impl<I: PartialEq + Clone + Ord> PartialEq for Graph<I>
impl<I: PartialEq + Clone + Ord> PartialEq for Graph<I>
source§impl<I: PartialOrd + Clone + Ord> PartialOrd for Graph<I>
impl<I: PartialOrd + Clone + Ord> PartialOrd for Graph<I>
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<I: Eq + Clone + Ord> Eq for Graph<I>
impl<I: Clone + Ord> StructuralEq for Graph<I>
impl<I: Clone + Ord> StructuralPartialEq for Graph<I>
Auto Trait Implementations§
impl<I> RefUnwindSafe for Graph<I>where I: RefUnwindSafe,
impl<I> Send for Graph<I>where I: Send,
impl<I> Sync for Graph<I>where I: Sync,
impl<I> Unpin for Graph<I>
impl<I> UnwindSafe for Graph<I>where I: RefUnwindSafe,
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