1
0

Add equality operator

This commit is contained in:
Jeff 2023-09-29 09:17:21 -04:00
parent b308c1852f
commit ad429b3563

View File

@ -98,8 +98,8 @@ impl Evaluator {
) -> Vec<Result<Value>> { ) -> Vec<Result<Value>> {
let mut results = Vec::with_capacity(self.items.len()); let mut results = Vec::with_capacity(self.items.len());
for root in &self.items { for item in &self.items {
match root { match item {
Item::Comment(comment) => results.push(Ok(Value::String(comment.clone()))), Item::Comment(comment) => results.push(Ok(Value::String(comment.clone()))),
Item::Statement(statement) => { Item::Statement(statement) => {
results.push(statement.run(context, &mut cursor, source)) results.push(statement.run(context, &mut cursor, source))
@ -295,6 +295,7 @@ impl Operation {
Ok(Value::Empty) Ok(Value::Empty)
} }
"==" => Ok(Value::Boolean(left == right)),
_ => return Err(Error::CustomMessage("Operator not supported.".to_string())), _ => return Err(Error::CustomMessage("Operator not supported.".to_string())),
}; };