aboutsummaryrefslogtreecommitdiff
path: root/core/operators.nom
diff options
context:
space:
mode:
authorBruce Hill <bitbucket@bruce-hill.com>2018-06-06 13:25:01 -0700
committerBruce Hill <bitbucket@bruce-hill.com>2018-06-06 13:25:34 -0700
commit810ae220bc2b1dfa07593b77f391e4da3b57a6bb (patch)
treef5cdf811e673f4674097cb770b4f7d1fe932efe1 /core/operators.nom
parent2d88c68d712cb90f7e122465381899cd9f578e47 (diff)
Added list/dict metatables to make comparison and string representations
simpler. Also deleted Counters.
Diffstat (limited to 'core/operators.nom')
-rw-r--r--core/operators.nom18
1 files changed, 2 insertions, 16 deletions
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)]"