diff options
| author | Bruce Hill <bitbucket@bruce-hill.com> | 2018-04-06 16:53:30 -0700 |
|---|---|---|
| committer | Bruce Hill <bitbucket@bruce-hill.com> | 2018-04-06 16:53:59 -0700 |
| commit | a49e97f0e3a8b69afbc375fac7e04fe49aaf0591 (patch) | |
| tree | 3f315e3cdbeec230c781c29b103508b208a4ca8d /core/operators.nom | |
| parent | 227b944bad992a8231e0b1577537322c341c068c (diff) | |
Retrofitted "%'s %" to parse as dot syntax.
Diffstat (limited to 'core/operators.nom')
| -rw-r--r-- | core/operators.nom | 18 |
1 files changed, 2 insertions, 16 deletions
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: |
