pub struct Cycles<G: Borrow<Cfg>> { /* private fields */ }Expand description
Provides information about cycles among unit derivations in the grammar. There are two ways of pruning cycles.
Implementations§
Source§impl<G: Borrow<Cfg>> Cycles<G>
impl<G: Borrow<Cfg>> Cycles<G>
Sourcepub fn cycle_free(&mut self) -> bool
pub fn cycle_free(&mut self) -> bool
Checks whether the grammar is cycle-free.
Sourcepub fn classify(&self) -> impl Iterator<Item = (&CfgRule, bool)> + '_
pub fn classify(&self) -> impl Iterator<Item = (&CfgRule, bool)> + '_
Iterates over rules that participate in a cycle.
Sourcepub fn cycle_participants(
&self,
get_cyclical: bool,
) -> impl Iterator<Item = &CfgRule> + '_
pub fn cycle_participants( &self, get_cyclical: bool, ) -> impl Iterator<Item = &CfgRule> + '_
Iterates over rules that participate in a cycle.
Source§impl<G: BorrowMut<Cfg>> Cycles<G>
impl<G: BorrowMut<Cfg>> Cycles<G>
Sourcepub fn remove_cycles(&mut self)
pub fn remove_cycles(&mut self)
Removes all rules that participate in a cycle. Doesn’t preserve the language represented by the grammar.
Sourcepub fn rewrite_cycles(&mut self)
pub fn rewrite_cycles(&mut self)
Rewrites all rules that participate in a cycle. Preserves the language represented by the grammar.
Auto Trait Implementations§
impl<G> Freeze for Cycles<G>where
G: Freeze,
impl<G> RefUnwindSafe for Cycles<G>where
G: RefUnwindSafe,
impl<G> Send for Cycles<G>where
G: Send,
impl<G> Sync for Cycles<G>where
G: Sync,
impl<G> Unpin for Cycles<G>where
G: Unpin,
impl<G> UnwindSafe for Cycles<G>where
G: UnwindSafe,
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