From 0e3aaa8b08a4b6652b82628c5efaf403b249d75b Mon Sep 17 00:00:00 2001 From: greg Date: Tue, 26 Jan 2016 02:57:09 -0800 Subject: [PATCH] Add conditional expression support --- src/eval.rs | 3 ++- src/parser.rs | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/eval.rs b/src/eval.rs index 73bb9b4..47641a7 100644 --- a/src/eval.rs +++ b/src/eval.rs @@ -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!(), } } diff --git a/src/parser.rs b/src/parser.rs index 3fcec92..29b2cf3 100644 --- a/src/parser.rs +++ b/src/parser.rs @@ -44,6 +44,7 @@ pub enum Expression { Variable(String), BinExp(String, Box, Box), Call(String, Vec), + Conditional(Box, Box, Option>), } impl fmt::Display for ASTNode {