From ce8c511929d22120581cff72cb32c186fb699099 Mon Sep 17 00:00:00 2001 From: greg Date: Fri, 22 Jan 2016 02:38:06 -0800 Subject: [PATCH] Evaluate additional operators --- src/eval.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/eval.rs b/src/eval.rs index 28161a8..53a79a5 100644 --- a/src/eval.rs +++ b/src/eval.rs @@ -143,6 +143,18 @@ impl Evaluator { (Number(l), Number(r)) => Number(l - r), _ => Null, }, + "*" => match (left, right) { + (Number(l), Number(r)) => Number(l * r), + _ => Null, + }, + "/" => match (left, right) { + (Number(l), Number(r)) if r != 0.0 => Number(l / r), + _ => Null, + }, + "%" => match (left, right) { + (Number(l), Number(r)) => Number(l % r), + _ => Null, + }, "=" => match (left, right) { (Variable(var), right) => { self.varmap.add_binding(var, right);