[−][src]Struct cfg::classification::useful::Usefulness
Contains the information about usefulness of the grammar's rules. Useful rules are both reachable and productive.
Methods
impl<'a, G> Usefulness<&'a mut G> where
G: ContextFree,
&'b G: ContextFreeRef<'b, Target = G>,
&'b mut G: ContextFreeMut<'b, Target = G>,
[src]
G: ContextFree,
&'b G: ContextFreeRef<'b, Target = G>,
&'b mut G: ContextFreeMut<'b, Target = G>,
pub fn new(grammar: &'a mut G) -> Usefulness<&'a mut G>
[src]
Analyzes usefulness of the grammar's rules. In particular, it checks for reachable and productive symbols.
pub fn productivity(&self, sym: Symbol) -> bool
[src]
Checks whether a symbol is productive. Can be used to determine the precise reason of a rule's unproductiveness.
pub fn reachable<Sr>(self, syms: Sr) -> Self where
Sr: AsRef<[Symbol]>,
[src]
Sr: AsRef<[Symbol]>,
Sets symbol reachability. Takes an array of reachable symbols.
pub fn all_useful(&self) -> bool
[src]
Checks whether all rules in the grammar are useful.
pub fn all_productive(&self) -> bool
[src]
Checks whether all rules in the grammar are productive.
impl<'a, G> Usefulness<&'a mut G> where
G: ContextFree,
&'a G: ContextFreeRef<'a, Target = G>,
&'a mut G: ContextFreeMut<'a, Target = G>,
[src]
G: ContextFree,
&'a G: ContextFreeRef<'a, Target = G>,
&'a mut G: ContextFreeMut<'a, Target = G>,
ⓘImportant traits for UselessRules<'a, G, <&'a G as ContextFreeRef<'a>>::Rules>pub fn useless_rules(
&'a self
) -> UselessRules<'a, G, <&'a G as ContextFreeRef<'a>>::Rules>
[src]
ⓘImportant traits for UselessRules<'a, G, <&'a G as ContextFreeRef<'a>>::Rules>
&'a self
) -> UselessRules<'a, G, <&'a G as ContextFreeRef<'a>>::Rules>
Returns an iterator over the grammar's useless rules.
pub fn remove_useless_rules(&mut self)
[src]
Removes useless rules. The language represented by the grammar doesn't change.
Auto Trait Implementations
impl<G> Send for Usefulness<G> where
G: Send,
G: Send,
impl<G> Sync for Usefulness<G> where
G: Sync,
G: Sync,
impl<G> Unpin for Usefulness<G> where
G: Unpin,
G: Unpin,
impl<G> UnwindSafe for Usefulness<G> where
G: UnwindSafe,
G: UnwindSafe,
impl<G> RefUnwindSafe for Usefulness<G> where
G: RefUnwindSafe,
G: RefUnwindSafe,
Blanket Implementations
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for T
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,