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
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.
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.
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.
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.
Returns from a function.
Fields of Return
values: Vec<Expression>
The values to be returned.
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.
Fields of FunctionCall
function: Expression
arguments: Vec<Expression>
Fields of MethodCall
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Statement
impl UnwindSafe for Statement
Blanket Implementations
Mutably borrows from an owned value. Read more