From a49e97f0e3a8b69afbc375fac7e04fe49aaf0591 Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Fri, 6 Apr 2018 16:53:30 -0700 Subject: Retrofitted "%'s %" to parse as dot syntax. --- core/operators.nom | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-) (limited to 'core') diff --git a/core/operators.nom b/core/operators.nom index 7a6f535..2015a57 100644 --- a/core/operators.nom +++ b/core/operators.nom @@ -11,24 +11,10 @@ immediately: It's also critical to have parens around %obj, otherwise Lua is too dumb to realize that {x=1}["x"] is the same as ({x=1})["x"] or that {x=1}.x is the same as ({x=1}).x - compile [..] + parse [..] %obj' %key, %obj's %key, %key in %obj, %key'th in %obj, %key of %obj, %key st in %obj, %key nd in %obj, %key rd in %obj, %key th in %obj, - ..to: - lua> ".." - local obj_lua = \(%obj as lua expr); - if not obj_lua:sub(-1,-1):match("[a-zA-Z)]") then - obj_lua = "("..obj_lua..")"; - end - local key_lua = \(%key as lua expr); - local key_attr = (key_lua:match("'([a-zA-Z][a-zA-Z0-9]*)'") - or key_lua:match('"([a-zA-Z][a-zA-Z0-9]*)"')); - if key_attr then - return {expr=obj_lua.."."..key_attr}; - elseif key_lua:sub(1,1) == "[" then - key_lua = " "..key_lua.." "; - end - return {expr=obj_lua.."["..key_lua.."]"}; + ..as: %obj.%key # Comparison Operators immediately: -- cgit v1.2.3