Add conditional expression support
This commit is contained in:
parent
f33cfdadfe
commit
0e3aaa8b08
@ -166,7 +166,8 @@ impl Evaluator {
|
|||||||
self.reduce_binop(op, left, right) //can assume both arguments are maximally reduced
|
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!(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -44,6 +44,7 @@ pub enum Expression {
|
|||||||
Variable(String),
|
Variable(String),
|
||||||
BinExp(String, Box<Expression>, Box<Expression>),
|
BinExp(String, Box<Expression>, Box<Expression>),
|
||||||
Call(String, Vec<Expression>),
|
Call(String, Vec<Expression>),
|
||||||
|
Conditional(Box<Expression>, Box<Expression>, Option<Box<Expression>>),
|
||||||
}
|
}
|
||||||
|
|
||||||
impl fmt::Display for ASTNode {
|
impl fmt::Display for ASTNode {
|
||||||
|
Loading…
Reference in New Issue
Block a user