From 7f47d4204039258cec78c767f489b7809b4257ff Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Sat, 17 Nov 2018 14:38:05 -0800 Subject: In-progress (but working) overhaul of some elements including: function calls, lib/thing.nom API, multi-assignments, varargs, etc. --- syntax_tree.moon | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'syntax_tree.moon') diff --git a/syntax_tree.moon b/syntax_tree.moon index dd10d77..71b9bac 100644 --- a/syntax_tree.moon +++ b/syntax_tree.moon @@ -39,11 +39,13 @@ class SyntaxTree table.insert(bits, "[ #{as_lua(k)}]=#{as_lua(v)}") return "SyntaxTree{#{table.concat(bits, ", ")}}" - @source_code_for_tree: setmetatable({}, {__index:(t)=> - s = t.source - Files = require 'files' - f = Files.read(s.filename) - return f + @source_code_for_tree: setmetatable({}, { + __index:(t)=> + s = t.source + Files = require 'files' + f = Files.read(s.filename) + return f + __mode: "k" }) get_source_file: => @@source_code_for_tree[@] get_source_code: => @@source_code_for_tree[@]\sub(@source.start, @source.stop) @@ -73,7 +75,10 @@ class SyntaxTree get_args: => assert(@type == "Action", "Only actions have arguments") - return [tok for tok in *@ when type(tok) != 'string'] + args = {@target} + for tok in *@ + if type(tok) != 'string' then args[#args+1] = tok + return args get_stub: => stub_bits = {} -- cgit v1.2.3