Add conditional expression support

This commit is contained in:
greg 2016-01-26 02:57:09 -08:00
parent f33cfdadfe
commit 0e3aaa8b08
2 changed files with 3 additions and 1 deletions

View File

@ -166,7 +166,8 @@ impl Evaluator {
self.reduce_binop(op, left, right) //can assume both arguments are maximally reduced
}
},
Call(name, args) => self.reduce_call(name, args)
Call(name, args) => self.reduce_call(name, args),
Conditional(_,_,_) => unimplemented!(),
}
}

View File

@ -44,6 +44,7 @@ pub enum Expression {
Variable(String),
BinExp(String, Box<Expression>, Box<Expression>),
Call(String, Vec<Expression>),
Conditional(Box<Expression>, Box<Expression>, Option<Box<Expression>>),
}
impl fmt::Display for ASTNode {