[−][src]Struct cfg::earley::grammar::Grammar
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]
&mut self,
lhs: Symbol
) -> RuleBuilder<&mut Cfg<History, History>, BuildHistory>
pub fn sequence(
&mut self,
lhs: Symbol
) -> SequenceRuleBuilder<History, &mut Vec<Sequence<History>>, BuildHistory>
[src]
&mut self,
lhs: Symbol
) -> SequenceRuleBuilder<History, &mut Vec<Sequence<History>>, BuildHistory>
pub fn binarize(&self) -> BinarizedGrammar
[src]
Methods from Deref<Target = Cfg<History, History>>
pub fn sym<T>(&mut self) -> T where
T: SymbolContainer,
[src]
T: SymbolContainer,
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]
&mut self,
lhs: Symbol
) -> SequenceRuleBuilder<Hs, &mut Vec<Sequence<Hs>>>
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]
&'a Self: ContextFreeRef<'a, Target = Self>,
H: Binarize + Clone + 'static,
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.
fn deref(&self) -> &Self::Target
[src]
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]
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,