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).

Fields of Labeled

label: String

The label.

rule: Box<Rule>

The rule.

Node(Node)

A node, like A.

Tuple Fields of Node

0: Node
Token(Token)

A token, like 'struct'.

Tuple Fields of Token

0: Token
Seq(Vec<Rule>)

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

Tuple Fields of Seq

0: Vec<Rule>
Alt(Vec<Rule>)

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

Tuple Fields of Alt

0: Vec<Rule>
Opt(Box<Rule>)

An optional rule, like A?.

Tuple Fields of Opt

0: Box<Rule>
Rep(Box<Rule>)

A repeated rule, like A*.

Tuple Fields of Rep

0: Box<Rule>

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.