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,

source

pub fn new(rules: D, lhs: Symbol) -> Self

Returns a precedenced rule builder.

source§

impl<D> PrecedencedRuleBuilder<D>where D: RuleContainer,

source

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.

source

pub fn rule(self, lhs: Symbol) -> RuleBuilder<D>

Starts building a new grammar rule.

source

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.

source

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.

source

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.

source

pub fn associativity(self, assoc: Associativity) -> Self

Assigns the associativity, which influences the next call to rhs or rhs_with_history.

source

pub fn lower_precedence(self) -> Self

Assigns lower precedence to rule alternatives that are built after this call.

source

pub fn finalize(self) -> RuleBuilder<D>

This internal method must be called to finalize the precedenced rule construction.

Auto Trait Implementations§

§

impl<D> RefUnwindSafe for PrecedencedRuleBuilder<D>where D: RefUnwindSafe,

§

impl<D> Send for PrecedencedRuleBuilder<D>where D: Send,

§

impl<D> Sync for PrecedencedRuleBuilder<D>where D: Sync,

§

impl<D> Unpin for PrecedencedRuleBuilder<D>where D: Unpin,

§

impl<D> UnwindSafe for PrecedencedRuleBuilder<D>where D: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.