Enum hematita::ast::parser::Statement[][src]

pub enum Statement {
    If {
        condition: Expression,
        then: Block,
        else_ifs: Vec<ElseIf>,
        else: Option<Block>,
    },
    GenericFor {
        variable: String,
        iterator: Expression,
        do: Block,
    },
    NumericFor {
        variable: String,
        first: Expression,
        limit: Expression,
        step: Expression,
        do: Block,
    },
    While {
        condition: Expression,
        block: Block,
        run_first: bool,
    },
    Return {
        values: Vec<Expression>,
    },
    Assign {
        variables: (AssignmentTarget, Vec<AssignmentTarget>),
        values: Vec<Expression>,
    },
    LocalAssign {
        variables: (String, Vec<String>),
        values: Vec<Expression>,
    },
    FunctionCall {
        function: Expression,
        arguments: Vec<Expression>,
    },
    MethodCall {
        class: Expression,
        method: String,
        arguments: Vec<Expression>,
    },
    Function {
        name: (String, Vec<String>),
        arguments: Vec<String>,
        body: Block,
    },
    LocalFunction {
        name: String,
        arguments: Vec<String>,
        body: Block,
    },
    Method {
        class: (String, Vec<String>),
        name: String,
        arguments: Vec<String>,
        body: Block,
    },
}

Variants

If

An if statement.

Fields of If

condition: Expression

The condition for the if statement.

then: Block

The block of statements to be ran if the condition is met.

else_ifs: Vec<ElseIf>

Other conditions and statements to evaluate if the main condition wasn’t met.

else: Option<Block>

The block of statements to be ran if no other conditions were met.

GenericFor

A for in loop.

Fields of GenericFor

variable: String

The variable to set to the value of each item being iterated.

iterator: Expression

The expression to evaluate to get the iterator.

do: Block

The block of statements to be ran every item.

NumericFor

A numeric for loop.

Fields of NumericFor

variable: String

The variable to set the first value to.

first: Expression

The first value.

limit: Expression

The limit.

step: Expression

The amount to step.

do: Block

The block of statements to be ran every time.

While

A while or repeat loop.

Fields of While

condition: Expression

The condition to check.

block: Block

The block of statements to be ran every time.

run_first: bool

Whether or not to run block first before checking condition.

Return

Returns from a function.

Fields of Return

values: Vec<Expression>

The values to be returned.

Assign

An assignment operator.

Fields of Assign

variables: (AssignmentTarget, Vec<AssignmentTarget>)

The names of the variables to assign to.

values: Vec<Expression>

The values to assign.

LocalAssign

Fields of LocalAssign

variables: (String, Vec<String>)values: Vec<Expression>
FunctionCall

Fields of FunctionCall

function: Expressionarguments: Vec<Expression>
MethodCall

Fields of MethodCall

class: Expressionmethod: Stringarguments: Vec<Expression>
Function

Fields of Function

name: (String, Vec<String>)arguments: Vec<String>body: Block
LocalFunction

Fields of LocalFunction

name: Stringarguments: Vec<String>body: Block
Method

Fields of Method

class: (String, Vec<String>)name: Stringarguments: Vec<String>body: Block

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Formats the value using the given formatter. Read more

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 resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

Converts the given value to a String. Read more

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.