add (^) as an evaluable factor, re: #39

This commit is contained in:
Mark Thom
2018-09-01 13:48:04 -06:00
parent db36958504
commit 78ea3f5441
9 changed files with 279 additions and 34 deletions

View File

@@ -105,6 +105,7 @@ impl<'a> ArithmeticEvaluator<'a>
-> Result<ArithmeticInstruction, ArithmeticError>
{
match name.as_str() {
"abs" => Ok(ArithmeticInstruction::Abs(a1, t)),
"-" => Ok(ArithmeticInstruction::Neg(a1, t)),
_ => Err(ArithmeticError::InvalidOp)
}
@@ -121,6 +122,7 @@ impl<'a> ArithmeticEvaluator<'a>
"div" => Ok(ArithmeticInstruction::FIDiv(a1, a2, t)),
"rdiv" => Ok(ArithmeticInstruction::RDiv(a1, a2, t)),
"*" => Ok(ArithmeticInstruction::Mul(a1, a2, t)),
"^" => Ok(ArithmeticInstruction::Pow(a1, a2, t)),
">>" => Ok(ArithmeticInstruction::Shr(a1, a2, t)),
"<<" => Ok(ArithmeticInstruction::Shl(a1, a2, t)),
"/\\" => Ok(ArithmeticInstruction::And(a1, a2, t)),