diff options
| author | Bruce Hill <bitbucket@bruce-hill.com> | 2018-05-16 15:44:07 -0700 |
|---|---|---|
| committer | Bruce Hill <bitbucket@bruce-hill.com> | 2018-05-16 15:45:59 -0700 |
| commit | af9dc0702568dc45b8809523dde760bb99aafbcb (patch) | |
| tree | 8334bab3a859aaa12ae5cb9f78b92f2eea5477b4 /nomsu.lua | |
| parent | 3ffeaf1f5dbf3e225dc536066d0fedda3f38ac70 (diff) | |
Converted DictEntry to be an actual tree, instead of a pseudo-tree, made 'parse % as %'
generate lua code with already-substituted tree literals instead of reparsing and
substituting at parse time, and made some general optimizations.
Diffstat (limited to 'nomsu.lua')
| -rw-r--r-- | nomsu.lua | 16 |
1 files changed, 2 insertions, 14 deletions
@@ -149,9 +149,6 @@ do _with_0.Tuple = function(values) return Tuple(unpack(values)) end - _with_0.DictEntry = function(k, v) - return Types.DictEntry(k, v) - end _with_0.nl = P("\r") ^ -1 * P("\n") _with_0.ws = S(" \t") _with_0.tonumber = tonumber @@ -467,24 +464,15 @@ do if not (Types.is_node(tree)) then return end - local _exp_0 = tree.type - if "List" == _exp_0 or "Block" == _exp_0 or "Action" == _exp_0 or "Text" == _exp_0 or "IndexChain" == _exp_0 then + if Tuple:is_instance(tree.value) then local _list_0 = tree.value for _index_0 = 1, #_list_0 do local v = _list_0[_index_0] self:walk_tree(v, depth + 1) end - elseif "Dict" == _exp_0 then - local _list_0 = tree.value - for _index_0 = 1, #_list_0 do - local e = _list_0[_index_0] - self:walk_tree(e.key, depth + 1) - self:walk_tree(e.value, depth + 1) - end else - self:walk_tree(tree.value, depth + 1) + return self:walk_tree(v, depth + 1) end - return nil end, tree_with_replacements = function(self, tree, replacements) if not (next(replacements)) then |
