aboutsummaryrefslogtreecommitdiff
path: root/nomsu_tree.lua
diff options
context:
space:
mode:
authorBruce Hill <bitbucket@bruce-hill.com>2018-06-18 18:10:59 -0700
committerBruce Hill <bitbucket@bruce-hill.com>2018-06-18 18:11:09 -0700
commitf83cc3ad8afaa122867270a9b1255295e902c422 (patch)
tree6d91f47c05f7173e3e447ae4f1412442edd6f6b2 /nomsu_tree.lua
parenta22de3fdbbebb310a07252bd99b1ca8acb685ea6 (diff)
More streamlining and cleanup.
Diffstat (limited to 'nomsu_tree.lua')
-rw-r--r--nomsu_tree.lua9
1 files changed, 6 insertions, 3 deletions
diff --git a/nomsu_tree.lua b/nomsu_tree.lua
index 05fb22c..227a674 100644
--- a/nomsu_tree.lua
+++ b/nomsu_tree.lua
@@ -9,8 +9,11 @@ local Source
Source = require("code_obj").Source
local unpack = unpack or table.unpack
local AST = { }
-AST.is_syntax_tree = function(n)
- return type(n) == 'table' and getmetatable(n) and AST[n.type] == getmetatable(n)
+AST.is_syntax_tree = function(n, t)
+ if t == nil then
+ t = nil
+ end
+ return type(n) == 'table' and getmetatable(n) and AST[n.type] == getmetatable(n) and (t == nil or n.type == t)
end
local types = {
"Number",
@@ -37,7 +40,7 @@ for _index_0 = 1, #types do
return getmetatable(x) == self
end
cls.__tostring = function(self)
- return tostring(self.name) .. "(" .. tostring(concat((function()
+ return tostring(self.type) .. "(" .. tostring(repr(tostring(self.source))) .. ", " .. tostring(concat((function()
local _accum_0 = { }
local _len_0 = 1
for _index_1 = 1, #self do