From 810ae220bc2b1dfa07593b77f391e4da3b57a6bb Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Wed, 6 Jun 2018 13:25:01 -0700 Subject: Added list/dict metatables to make comparison and string representations simpler. Also deleted Counters. --- core/operators.nom | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-) (limited to 'core/operators.nom') diff --git a/core/operators.nom b/core/operators.nom index dd57cea..4ec8ff1 100644 --- a/core/operators.nom +++ b/core/operators.nom @@ -23,23 +23,9 @@ immediately compile [%x <= %y] to: Lua value "(\(%x as lua expr) <= \(%y as lua expr))" compile [%x >= %y] to: Lua value "(\(%x as lua expr) >= \(%y as lua expr))" compile [%a is %b, %a = %b, %a == %b] to - lua> ".." - local safe = {Text=true, Number=true} - local a_lua, b_lua = \(%a as lua), \(%b as lua) - if safe[\%a.type] or safe[\%b.type] then - return Lua.Value(tree.source, "(", a_lua, " == ", b_lua, ")") - else - return Lua.Value(tree.source, "utils.equivalent(", a_lua, ", ", b_lua, ")") - end + Lua value "(\(%a as lua expr) == \(%b as lua expr))" compile [%a isn't %b, %a is not %b, %a not= %b, %a != %b] to - lua> ".." - local safe = {Text=true, Number=true} - local a_lua, b_lua = \(%a as lua), \(%b as lua) - if safe[\%a.type] or safe[\%b.type] then - return Lua.Value(tree.source, "(", a_lua, " ~= ", b_lua, ")") - else - return Lua.Value(tree.source, "(not utils.equivalent(", a_lua, ", ", b_lua, "))") - end + Lua value "(\(%a as lua expr) ~= \(%b as lua expr))" # For strict identity checking, use (%x's id) is (%y's id) compile [%'s id, id of %] to: Lua value "nomsu.ids[\(% as lua expr)]" -- cgit v1.2.3