23 lines
525 B
Rust
23 lines
525 B
Rust
use crate::{expression::Expression, token::Token};
|
|
|
|
/// Enumeration of all types of statements.
|
|
#[derive(Debug, Clone, PartialEq)]
|
|
pub enum Statement {
|
|
Block(Vec<Statement>),
|
|
Print(Expression),
|
|
Expression(Expression),
|
|
Var {
|
|
name: Token,
|
|
initializer: Box<Option<Expression>>,
|
|
},
|
|
If {
|
|
condition: Expression,
|
|
then_branch: Box<Statement>,
|
|
else_branch: Option<Box<Statement>>,
|
|
},
|
|
While {
|
|
condition: Expression,
|
|
body: Box<Statement>,
|
|
},
|
|
}
|