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>,
    },
    Return {
        expression: Expression,
    },
    Expression {
        expression: Expression,
    },
    Use {
        module: String,
        imports: Vec<String>,
    },
    Break,
    Continue,
}
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

identifier: String
type: Option<Type>
initial: Expression

Function

Fields

identifier: String
parameters: Vec<Parameter>
return_type: Option<Type>
body: Vec<Statement>

If

Fields

condition: Expression
then: Vec<Statement>
otherwise: Vec<Statement>

While

Fields

condition: Expression
then: Vec<Statement>

Return

Fields

expression: Expression

Expression

Fields

expression: Expression

Use

Fields

module: String
imports: Vec<String>

Break

Continue

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.