Struct gearley::grammar::Grammar
[−]
[src]
pub struct Grammar { /* fields omitted */ }
Drop-in replacement for cfg::Cfg that traces relations between user-provided and internal grammars.
Methods
impl Grammar
[src]
fn new() -> Self
fn set_start(&mut self, start: Symbol)
fn get_start(&self) -> Symbol
fn rule(
&mut self,
lhs: Symbol
) -> RuleBuilder<&mut Cfg<History, History>, BuildHistory>
&mut self,
lhs: Symbol
) -> RuleBuilder<&mut Cfg<History, History>, BuildHistory>
fn sequence(
&mut self,
lhs: Symbol
) -> SequenceRuleBuilder<History, &mut Vec<Sequence<History>>, BuildHistory>
&mut self,
lhs: Symbol
) -> SequenceRuleBuilder<History, &mut Vec<Sequence<History>>, BuildHistory>
fn binarize(&self) -> BinarizedGrammar
fn into_internal_grammar(&self) -> InternalGrammar
Methods from Deref<Target = Cfg<History, History>>
fn sym<T>(&mut self) -> T where
T: SymbolContainer,
T: SymbolContainer,
Returns generated symbols.
fn next_sym(&mut self) -> Symbol
Generates a new unique symbol.
fn num_syms(&self) -> usize
Returns the number of symbols in use.
fn sequence(
&mut self,
lhs: Symbol
) -> SequenceRuleBuilder<Hs, &mut Vec<Sequence<Hs>>, NullHistorySource>
&mut self,
lhs: Symbol
) -> SequenceRuleBuilder<Hs, &mut Vec<Sequence<Hs>>, NullHistorySource>
Starts building a sequence rule.
fn sequence_rules(&self) -> &[Sequence<Hs>]
Returns sequence rules.
fn rewrite_sequences(&mut self)
Forces a rewrite of sequence rules into grammar rules.
fn binarize<'a>(&'a self) -> BinarizedCfg<H> where
H: Binarize + Clone + 'static,
&'a Cfg<H, Hs>: ContextFreeRef<'a>,
<&'a Cfg<H, Hs> as Deref>::Target == Cfg<H, Hs>,
H: Binarize + Clone + 'static,
&'a Cfg<H, Hs>: ContextFreeRef<'a>,
<&'a Cfg<H, Hs> as Deref>::Target == Cfg<H, Hs>,
Returns a binarized grammar which is weakly equivalent to this grammar.
Trait Implementations
impl Deref for Grammar
[src]
type Target = Cfg<History, History>
The resulting type after dereferencing
fn deref(&self) -> &Self::Target
The method called to dereference a value