use super::{Expression, Identifier};
#[derive(Debug, Clone, PartialEq)]
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[non_exhaustive]
pub enum Statement {
Let(LetStatement),
Assign(AssignStatement),
Expression(Expression),
#[cfg(feature = "while_loop")]
While(WhileLoop),
#[cfg(feature = "while_loop")]
Break,
#[cfg(feature = "while_loop")]
Continue,
Return(ReturnStatement),
}
#[derive(Debug, Clone, PartialEq)]
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[non_exhaustive]
pub struct LetStatement {
pub identifier: Identifier,
pub expression: Expression,
}
#[derive(Debug, Clone, PartialEq)]
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[non_exhaustive]
pub struct AssignStatement {
pub identifier: Identifier,
pub expression: Expression,
}
#[derive(Debug, Clone, PartialEq)]
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[non_exhaustive]
pub struct ReturnStatement {
pub value: Option<Expression>,
}
#[derive(Debug, Clone, PartialEq)]
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[non_exhaustive]
#[cfg(feature = "while_loop")]
pub struct WhileLoop {
pub condition: Expression,
pub body: Vec<Statement>,
}