Added cart support into AST

This commit is contained in:
Erin 2021-07-27 11:51:05 +02:00 committed by ondra05
parent 282a9a6a07
commit e847a76c6d
2 changed files with 6 additions and 0 deletions

View file

@ -102,6 +102,11 @@ pub enum ExprKind {
}, },
Not(Box<Expr>), Not(Box<Expr>),
Literal(Value), Literal(Value),
Cart(Vec<(Expr, Expr)>),
Index {
cart: Box<Expr>,
index: Box<Expr>,
},
Variable(String), Variable(String),
} }

View file

@ -195,6 +195,7 @@ impl ExecEnv {
} }
Not(expr) => Bool(!self.eval_expr(&expr)?.into_bool()), Not(expr) => Bool(!self.eval_expr(&expr)?.into_bool()),
Literal(value) => value.clone(), Literal(value) => value.clone(),
Cart(_) | Index { .. } => todo!("cart support"),
// TODO: not too happy with constructing an artificial // TODO: not too happy with constructing an artificial
// Iden here. // Iden here.