From bf67a610135c0803187cf6ed896638962f142d14 Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Wed, 18 Jul 2018 17:55:29 -0700 Subject: Updating to version 2.4.4.3, with new syntax for multi-statement 'if' and switch statements. --- core/operators.nom | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'core/operators.nom') diff --git a/core/operators.nom b/core/operators.nom index 70b0207..bce91c4 100644 --- a/core/operators.nom +++ b/core/operators.nom @@ -1,4 +1,4 @@ -#!/usr/bin/env nomsu -V2.3.4.3 +#!/usr/bin/env nomsu -V2.4.4.3 # This file contains definitions of operators like "+" and "and". @@ -147,21 +147,29 @@ compile [%x wrapped around %y, %x mod %y] to (..) # (uses a lambda to avoid re-evaluating middle value, while still being an expression) parse [%x < %y < %z] as (..) =lua "(function(x,y,z) return x < y and y < z; end)(\%x,\%y,\%z)" + parse [%x <= %y < %z] as (..) =lua "(function(x,y,z) return x <= y and y < z; end)(\%x,\%y,\%z)" + parse [%x < %y <= %z] as (..) =lua "(function(x,y,z) return x < y and y <= z; end)(\%x,\%y,\%z)" + parse [%x <= %y <= %z] as (..) =lua "(function(x,y,z) return x <= y and y <= z; end)(\%x,\%y,\%z)" + parse [%x > %y > %z] as (..) =lua "(function(x,y,z) return x > y and y > z; end)(\%x,\%y,\%z)" + parse [%x >= %y > %z] as (..) =lua "(function(x,y,z) return x >= y and y > z; end)(\%x,\%y,\%z)" + parse [%x > %y >= %z] as (..) =lua "(function(x,y,z) return x > y and y >= z; end)(\%x,\%y,\%z)" + parse [%x >= %y >= %z] as (..) =lua "(function(x,y,z) return x >= y and y >= z; end)(\%x,\%y,\%z)" + # TODO: optimize for common case where x,y,z are all either variables or number literals # Boolean Operators compile [%x and %y] to (Lua value "(\(%x as lua expr) and \(%y as lua expr))") @@ -204,4 +212,4 @@ parse [%var /= %] as (%var = (%var / %)) parse [%var ^= %] as (%var = (%var ^ %)) parse [%var and= %] as (%var = (%var and %)) parse [%var or= %] as (%var = (%var or %)) -parse [wrap %var around %] as (%var = (%var wrapped around %)) +parse [wrap %var around %] as (%var = (%var wrapped around %)) \ No newline at end of file -- cgit v1.2.3