Struct cfg::rule::builder::RuleBuilder [] [src]

pub struct RuleBuilder<C, Hs = NullHistorySource> where C: RuleContainer {
    // some fields omitted
}

The rule builder.

Methods

impl<C> RuleBuilder<C> where C: RuleContainer

fn new(rules: C) -> RuleBuilder<C>

Creates a rule builder.

impl<C, Hs> RuleBuilder<C, Hs> where C: RuleContainer

fn default_history<Hs2>(self, state: Hs2) -> RuleBuilder<C, Hs2>

Sets the default history source.

fn rule(self, lhs: Symbol) -> Self

Starts building a new rule with the given LHS.

fn history(self, history: C::History) -> Self

Assigns the rule history, which is used on the next call to rhs, or overwritten by a call torhs_with_history.

fn rhs<Sr>(self, syms: Sr) -> Self where Sr: AsRef<[Symbol]>, Hs: HistorySource<C::History>

Adds a rule alternative to the grammar. If history wasn't provided, the rule has the Default history.

fn rhs_with_history<Sr>(self, syms: Sr, history: C::History) -> Self where Sr: AsRef<[Symbol]>

Adds a rule alternative with the given RHS and history to the grammar.

fn precedenced_rule(self, lhs: Symbol) -> PrecedencedRuleBuilder<C> where C::History: AssignPrecedence + Default

Starts building a new precedenced rule.