Enum ungrammar::Rule[][src]

pub enum Rule {
    Labeled {
        label: String,
        rule: Box<Rule>,
    },
    Node(Node),
    Token(Token),
    Seq(Vec<Rule>),
    Alt(Vec<Rule>),
    Opt(Box<Rule>),
    Rep(Box<Rule>),
}
Expand description

A production rule.

Variants

Labeled

A labeled rule, like a:B ("a" is the label, B is the rule).

Show fields

Fields of Labeled

label: String

The label.

rule: Box<Rule>

The rule.

Node(Node)

A node, like A.

Token(Token)

A token, like 'struct'.

Seq(Vec<Rule>)

A sequence of rules, like 'while' '(' Expr ')' Stmt.

Alt(Vec<Rule>)

An alternative between many rules, like '+' | '-' | '*' | '/'.

Opt(Box<Rule>)

An optional rule, like A?.

Rep(Box<Rule>)

A repeated rule, like A*.

Trait Implementations

Formats the value using the given formatter. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.