pub struct RuleBuilder<'a> { /* private fields */ }Expand description
The rule builder.
Implementations§
Source§impl<'a> RuleBuilder<'a>
impl<'a> RuleBuilder<'a>
Sourcepub fn new(grammar: &'a mut Cfg) -> RuleBuilder<'a>
pub fn new(grammar: &'a mut Cfg) -> RuleBuilder<'a>
Creates a rule builder.
Source§impl<'a> RuleBuilder<'a>
impl<'a> RuleBuilder<'a>
Sourcepub fn rule(self, lhs: Symbol) -> RuleBuilder<'a>
pub fn rule(self, lhs: Symbol) -> RuleBuilder<'a>
Starts building a new rule with the given LHS.
Sourcepub fn history(self, history: History) -> RuleBuilder<'a>
pub fn history(self, history: History) -> RuleBuilder<'a>
Assigns the rule history, which is used on the next call to rhs, or overwritten by a call
to rhs_with_history.
Sourcepub fn rhs(self, syms: impl AsRef<[Symbol]>) -> RuleBuilder<'a>
pub fn rhs(self, syms: impl AsRef<[Symbol]>) -> RuleBuilder<'a>
Adds a rule alternative to the grammar. If history wasn’t provided, the rule has the
Default history.
Sourcepub fn rhs_with_history(
self,
syms: impl AsRef<[Symbol]>,
history: History,
) -> RuleBuilder<'a>
pub fn rhs_with_history( self, syms: impl AsRef<[Symbol]>, history: History, ) -> RuleBuilder<'a>
Adds a rule alternative with the given RHS and history to the grammar.
Sourcepub fn rhs_with_linked_history(
self,
syms: impl AsRef<[Symbol]>,
linked_history: LinkedHistoryNode,
) -> RuleBuilder<'a>
pub fn rhs_with_linked_history( self, syms: impl AsRef<[Symbol]>, linked_history: LinkedHistoryNode, ) -> RuleBuilder<'a>
Adds a rule alternative with the given RHS and history to the grammar.
Sourcepub fn precedenced_rule(self, lhs: Symbol) -> PrecedencedRuleBuilder<'a>
pub fn precedenced_rule(self, lhs: Symbol) -> PrecedencedRuleBuilder<'a>
Starts building a new precedenced rule.
Auto Trait Implementations§
impl<'a> Freeze for RuleBuilder<'a>
impl<'a> !RefUnwindSafe for RuleBuilder<'a>
impl<'a> !Send for RuleBuilder<'a>
impl<'a> !Sync for RuleBuilder<'a>
impl<'a> Unpin for RuleBuilder<'a>
impl<'a> !UnwindSafe for RuleBuilder<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more