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,
},
}
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
Fields of Let
Fields of Function
Fields of If
Fields of While
condition: Expression
then: Vec<Statement>
Fields of Return
expression: Expression
Fields of Expression
expression: Expression