[−][src]Struct cfg::earley::BinarizedGrammar
Drop-in replacement for cfg::BinarizedCfg
.
Methods
impl BinarizedGrammar
[src]
pub fn new() -> Self
[src]
Creates a new BinarizedGrammar
.
pub fn set_start(&mut self, start: Symbol)
[src]
pub fn start(&self) -> Symbol
[src]
impl BinarizedGrammar
[src]
pub fn wrap_start(&mut self)
[src]
pub fn original_start(&self) -> Option<Symbol>
[src]
pub fn eof(&self) -> Option<Symbol>
[src]
pub fn dot_before_eof(&self) -> Option<u32>
[src]
pub fn make_proper(self: BinarizedGrammar) -> BinarizedGrammar
[src]
pub fn eliminate_nulling(
self: BinarizedGrammar
) -> (BinarizedGrammar, BinarizedGrammar)
[src]
self: BinarizedGrammar
) -> (BinarizedGrammar, BinarizedGrammar)
pub fn remap_symbols(self: BinarizedGrammar) -> (BinarizedGrammar, Mapping)
[src]
pub fn is_empty(&self) -> bool
[src]
Methods from Deref<Target = BinarizedCfg<History>>
pub fn sort(&mut self)
[src]
Sorts the rule array.
pub fn sort_by<F>(&mut self, compare: F) where
F: FnMut(&BinarizedRule<H>, &BinarizedRule<H>) -> Ordering,
[src]
F: FnMut(&BinarizedRule<H>, &BinarizedRule<H>) -> Ordering,
Sorts the rule array in place, using the argument to compare elements.
pub fn dedup(&mut self)
[src]
Removes consecutive duplicate rules.
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 eliminate_nulling_rules(&mut self) -> BinarizedCfg<H>
[src]
Eliminates all rules of the form A ::= epsilon
.
In other words, this splits off the set of nulling rules.
The language represented by the grammar is preserved, except for the possible lack of the empty string. Unproductive rules aren't preserved.
Trait Implementations
impl ContextFree for BinarizedGrammar
[src]
fn rule(&mut self, lhs: Symbol) -> RuleBuilder<&mut Self>
[src]
fn precedenced_rule(&mut self, lhs: Symbol) -> PrecedencedRuleBuilder<&mut Self> where
Self::History: AssignPrecedence + Default,
[src]
Self::History: AssignPrecedence + Default,
impl<'a> ContextFreeRef<'a> for &'a BinarizedGrammar
[src]
type RuleRef = RuleRef<'a, History>
Immutable reference to a rule.
type Rules = BinarizedRules<'a, History>
Iterator over immutable references to the grammar's rules.
fn rules(self) -> Self::Rules
[src]
fn reverse(self) -> Self::Target where
<Self::Target as RuleContainer>::History: Clone,
Self::Target: EmptyRuleContainer,
[src]
<Self::Target as RuleContainer>::History: Clone,
Self::Target: EmptyRuleContainer,
impl RuleContainer for BinarizedGrammar
[src]
type History = History
The type of history carried with the rule.
fn sym_source(&self) -> &SymbolSource
[src]
fn sym_source_mut(&mut self) -> &mut SymbolSource
[src]
fn retain<F>(&mut self, f: F) where
F: FnMut(Symbol, &[Symbol], &History) -> bool,
[src]
F: FnMut(Symbol, &[Symbol], &History) -> bool,
fn add_rule(&mut self, lhs: Symbol, rhs: &[Symbol], history: History)
[src]
fn sym<T>(&mut self) -> T where
T: SymbolContainer,
[src]
T: SymbolContainer,
fn next_sym(&mut self) -> Symbol
[src]
fn num_syms(&self) -> usize
[src]
impl Clone for BinarizedGrammar
[src]
fn clone(&self) -> BinarizedGrammar
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Default for BinarizedGrammar
[src]
fn default() -> BinarizedGrammar
[src]
impl Deref for BinarizedGrammar
[src]
type Target = BinarizedCfg<History>
The resulting type after dereferencing.
fn deref(&self) -> &Self::Target
[src]
impl DerefMut for BinarizedGrammar
[src]
Auto Trait Implementations
impl Send for BinarizedGrammar
impl Sync for BinarizedGrammar
impl Unpin for BinarizedGrammar
impl UnwindSafe for BinarizedGrammar
impl RefUnwindSafe for BinarizedGrammar
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> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut 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,