[][src]Struct cfg::earley::grammar::Grammar

pub struct Grammar { /* fields omitted */ }

Drop-in replacement for cfg::Cfg that traces relations between user-provided and internal grammars.

Methods

impl Grammar[src]

pub fn new() -> Self[src]

pub fn set_start(&mut self, start: Symbol)[src]

pub fn start(&self) -> Symbol[src]

pub fn rule(
    &mut self,
    lhs: Symbol
) -> RuleBuilder<&mut Cfg<History, History>, BuildHistory>
[src]

pub fn sequence(
    &mut self,
    lhs: Symbol
) -> SequenceRuleBuilder<History, &mut Vec<Sequence<History>>, BuildHistory>
[src]

pub fn binarize(&self) -> BinarizedGrammar[src]

Methods from Deref<Target = Cfg<History, History>>

pub fn sym<T>(&mut self) -> T where
    T: SymbolContainer
[src]

Returns generated symbols.

pub fn next_sym(&mut self) -> Symbol[src]

Generates a new unique symbol.

pub fn num_syms(&self) -> usize[src]

Returns the number of symbols in use.

pub fn sequence(
    &mut self,
    lhs: Symbol
) -> SequenceRuleBuilder<Hs, &mut Vec<Sequence<Hs>>>
[src]

Starts building a sequence rule.

pub fn sequence_rules(&self) -> &[Sequence<Hs>][src]

Returns sequence rules.

pub fn rewrite_sequences(&mut self)[src]

Forces a rewrite of sequence rules into grammar rules.

pub fn binarize<'a>(&'a self) -> BinarizedCfg<H> where
    &'a Self: ContextFreeRef<'a, Target = Self>,
    H: Binarize + Clone + 'static, 
[src]

Returns a binarized grammar which is weakly equivalent to this grammar.

Trait Implementations

impl Default for Grammar[src]

impl Deref for Grammar[src]

type Target = Cfg<History, History>

The resulting type after dereferencing.

impl DerefMut for Grammar[src]

Auto Trait Implementations

impl Send for Grammar

impl Sync for Grammar

impl Unpin for Grammar

impl UnwindSafe for Grammar

impl RefUnwindSafe for Grammar

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]