From ed996ad1b690c45ffb33dacb9eccd45e7364dce5 Mon Sep 17 00:00:00 2001 From: Bruce Hill <bitbucket@bruce-hill.com> Date: Thu, 26 Jul 2018 12:38:17 -0700 Subject: [PATCH] Switching compile action to parse action for 3-way comparison. --- core/operators.nom | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/core/operators.nom b/core/operators.nom index 2805b87..a44f06b 100644 --- a/core/operators.nom +++ b/core/operators.nom @@ -206,28 +206,28 @@ test: Three-way comparison evaluated middle value multiple times parse [%x < %y < %z] as (..) - =lua "(function(x,y,z) return x < y and y < z; end)(\%x,\%y,\%z)" + call ([%a, %b, %c] -> ((%a < %b) and (%b < %c))) with [%x, %y, %z] parse [%x <= %y < %z] as (..) - =lua "(function(x,y,z) return x <= y and y < z; end)(\%x,\%y,\%z)" + call ([%a, %b, %c] -> ((%a <= %b) and (%b < %c))) with [%x, %y, %z] parse [%x < %y <= %z] as (..) - =lua "(function(x,y,z) return x < y and y <= z; end)(\%x,\%y,\%z)" + call ([%a, %b, %c] -> ((%a < %b) and (%b <= %c))) with [%x, %y, %z] parse [%x <= %y <= %z] as (..) - =lua "(function(x,y,z) return x <= y and y <= z; end)(\%x,\%y,\%z)" + call ([%a, %b, %c] -> ((%a <= %b) and (%b <= %c))) with [%x, %y, %z] parse [%x > %y > %z] as (..) - =lua "(function(x,y,z) return x > y and y > z; end)(\%x,\%y,\%z)" + call ([%a, %b, %c] -> ((%a > %b) and (%b > %c))) with [%x, %y, %z] parse [%x >= %y > %z] as (..) - =lua "(function(x,y,z) return x >= y and y > z; end)(\%x,\%y,\%z)" + call ([%a, %b, %c] -> ((%a >= %b) and (%b > %c))) with [%x, %y, %z] parse [%x > %y >= %z] as (..) - =lua "(function(x,y,z) return x > y and y >= z; end)(\%x,\%y,\%z)" + call ([%a, %b, %c] -> ((%a > %b) and (%b >= %c))) with [%x, %y, %z] parse [%x >= %y >= %z] as (..) - =lua "(function(x,y,z) return x >= y and y >= z; end)(\%x,\%y,\%z)" + call ([%a, %b, %c] -> ((%a >= %b) and (%b >= %c))) with [%x, %y, %z] # TODO: optimize for common case where x,y,z are all either variables or number literals # Boolean Operators