Evaluate additional operators

This commit is contained in:
greg 2016-01-22 02:38:06 -08:00
parent a8cafa8c64
commit ce8c511929

View File

@ -143,6 +143,18 @@ impl Evaluator {
(Number(l), Number(r)) => Number(l - r), (Number(l), Number(r)) => Number(l - r),
_ => Null, _ => 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) { "=" => match (left, right) {
(Variable(var), right) => { (Variable(var), right) => {
self.varmap.add_binding(var, right); self.varmap.add_binding(var, right);