added if expression
This commit is contained in:
16
src/ast.rs
16
src/ast.rs
@@ -128,6 +128,12 @@ pub struct LiteralFloat {
|
||||
pub type_: TypeUsage,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
|
||||
pub struct LiteralBool {
|
||||
pub value: Spanned<String>,
|
||||
pub type_: TypeUsage,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
|
||||
pub struct LiteralStruct {
|
||||
pub name: Identifier,
|
||||
@@ -167,13 +173,23 @@ pub struct VariableUsage {
|
||||
pub type_: TypeUsage,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
|
||||
pub struct IfExpression {
|
||||
pub condition: Expression,
|
||||
pub block: Block,
|
||||
pub else_: Option<Block>,
|
||||
pub type_: TypeUsage,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
|
||||
pub enum Subexpression {
|
||||
LiteralInt(LiteralInt),
|
||||
LiteralFloat(LiteralFloat),
|
||||
LiteralBool(LiteralBool),
|
||||
LiteralStruct(LiteralStruct),
|
||||
FunctionCall(FunctionCall),
|
||||
VariableUsage(VariableUsage),
|
||||
If(IfExpression),
|
||||
StructGetter(StructGetter),
|
||||
Block(Block),
|
||||
Op(Operation),
|
||||
|
||||
Reference in New Issue
Block a user