use crate::syn::Spanned; #[derive(Debug, Clone)] pub enum Stmt { Assign(SpAssignLhs, SpExpr), Expr(SpExpr), If { if_true: SpCondExpr, elseif: Vec, else_expr: Option, }, Def { name: String, params: Vec, body: Vec, }, Import { target: String, from: Option, }, } pub type SpAssignLhs = Spanned; #[derive(Debug, Clone)] pub enum AssignLhs { /// A simple assignment. /// /// `x = foo` Name(String), /// A more complex assignment. /// /// `x().bar = foo` Complex(SpExpr, String), } pub type SpStmt = Spanned; #[derive(Debug, Clone)] pub struct CondExpr { pub cond: SpExpr, pub expr: SpExpr, } pub type SpCondExpr = Spanned; #[derive(Debug, Clone)] pub struct Param { pub name: String, pub ty: Option, } pub type SpParam = Spanned; #[derive(Debug, Clone)] pub enum Expr { Call(Box, Vec), Get(Box, String), Atom(SpAtom), } pub type SpExpr = Spanned; #[derive(Debug, Clone)] pub enum Atom { Int(i64), Float(f64), Str(String), Sym(String), Name(String), } pub type SpAtom = Spanned;