Struct cfg::precedence::PrecedencedRuleBuilder
source · pub struct PrecedencedRuleBuilder<D>where
D: RuleContainer,{ /* private fields */ }
Expand description
Precedenced rules are built in series of rule alternatives with equal precedence.
Implementations§
source§impl<D> PrecedencedRuleBuilder<D>where
D: RuleContainer,
impl<D> PrecedencedRuleBuilder<D>where D: RuleContainer,
source§impl<D> PrecedencedRuleBuilder<D>where
D: RuleContainer,
impl<D> PrecedencedRuleBuilder<D>where D: RuleContainer,
sourcepub fn precedenced_rule(self, lhs: Symbol) -> PrecedencedRuleBuilder<D>
pub fn precedenced_rule(self, lhs: Symbol) -> PrecedencedRuleBuilder<D>
Starts building a new precedenced rule. The differences in precedence among rules only matter within a particular precedenced rule.
sourcepub fn rule(self, lhs: Symbol) -> RuleBuilder<D>
pub fn rule(self, lhs: Symbol) -> RuleBuilder<D>
Starts building a new grammar rule.
sourcepub fn history(self, history: HistoryId) -> Self
pub fn history(self, history: HistoryId) -> Self
Assigns the rule history, which is used on the next call to rhs
, unless overwritten by
a call to rhs_with_history
.
sourcepub fn rhs<S>(self, syms: S) -> Selfwhere
S: AsRef<[Symbol]>,
pub fn rhs<S>(self, syms: S) -> Selfwhere S: AsRef<[Symbol]>,
Creates a rule alternative. If history wasn’t provided, the rule has the Default
history.
sourcepub fn rhs_with_history<S>(self, syms: S, history_id: HistoryId) -> Selfwhere
S: AsRef<[Symbol]>,
pub fn rhs_with_history<S>(self, syms: S, history_id: HistoryId) -> Selfwhere S: AsRef<[Symbol]>,
Creates a rule alternative with the given RHS and history.
sourcepub fn associativity(self, assoc: Associativity) -> Self
pub fn associativity(self, assoc: Associativity) -> Self
Assigns the associativity, which influences the next call to rhs
or rhs_with_history
.
sourcepub fn lower_precedence(self) -> Self
pub fn lower_precedence(self) -> Self
Assigns lower precedence to rule alternatives that are built after this call.
sourcepub fn finalize(self) -> RuleBuilder<D>
pub fn finalize(self) -> RuleBuilder<D>
This internal method must be called to finalize the precedenced rule construction.