aboutsummaryrefslogtreecommitdiff
path: root/nomsu.moon
diff options
context:
space:
mode:
Diffstat (limited to 'nomsu.moon')
-rwxr-xr-xnomsu.moon16
1 files changed, 5 insertions, 11 deletions
diff --git a/nomsu.moon b/nomsu.moon
index ce0e8d6..db196fc 100755
--- a/nomsu.moon
+++ b/nomsu.moon
@@ -131,7 +131,6 @@ NOMSU_DEFS = with {}
-- Newline supports either windows-style CR+LF or unix-style LF
.Tuple = (values)->
return Tuple(unpack(values))
- .DictEntry = (k,v) -> Types.DictEntry(k,v)
.nl = P("\r")^-1 * P("\n")
.ws = S(" \t")
.tonumber = tonumber
@@ -429,16 +428,11 @@ class NomsuCompiler
walk_tree: (tree, depth=0)=>
coroutine.yield(tree, depth)
return unless Types.is_node(tree)
- switch tree.type
- when "List", "Block", "Action", "Text", "IndexChain"
- for v in *tree.value
- @walk_tree(v, depth+1)
- when "Dict"
- for e in *tree.value
- @walk_tree(e.key, depth+1)
- @walk_tree(e.value, depth+1)
- else @walk_tree(tree.value, depth+1)
- return nil
+ if Tuple\is_instance(tree.value)
+ for v in *tree.value
+ @walk_tree(v, depth+1)
+ else
+ @walk_tree(v, depth+1)
tree_with_replacements: (tree, replacements)=>
return tree unless next(replacements)