[][src]Struct cfg::classification::useful::Usefulness

pub struct Usefulness<G> { /* fields omitted */ }

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]

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]

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]

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]

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

impl<G> Sync for Usefulness<G> where
    G: Sync

impl<G> Unpin for Usefulness<G> where
    G: Unpin

impl<G> UnwindSafe for Usefulness<G> where
    G: UnwindSafe

impl<G> RefUnwindSafe for Usefulness<G> where
    G: RefUnwindSafe

Blanket Implementations

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]