Enum tonic_parser::Statement[][src]

pub enum Statement {
    Let {
        identifier: String,
        type: Option<Type>,
        initial: Expression,
    },
    Function {
        identifier: String,
        parameters: Vec<Parameter>,
        return_type: Option<Type>,
        body: Vec<Statement>,
    },
    If {
        condition: Expression,
        then: Vec<Statement>,
        otherwise: Vec<Statement>,
    },
    While {
        condition: Expression,
        then: Vec<Statement>,
    },
    Expression {
        expression: Expression,
    },
}
Expand description

The main type of Node in Tonic. Every line in the source code will eventually be parsed into a Statement, including arbitrary expressions.

This enum is used to describe the most common structures in the Tonic language. It does not hold any information about the position of the node, that is the responsibility of Node.

Variants

Let

Fields of Let

identifier: Stringtype: Option<Type>initial: Expression
Function

Fields of Function

identifier: Stringparameters: Vec<Parameter>return_type: Option<Type>body: Vec<Statement>
If

Fields of If

condition: Expressionthen: Vec<Statement>otherwise: Vec<Statement>
While

Fields of While

condition: Expressionthen: Vec<Statement>
Expression

Fields of Expression

expression: Expression

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.