From 63d8b1cd3f34b15bf86210b99209e8b57e7019bb Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Fri, 28 Sep 2018 22:15:06 -0700 Subject: Fully working, I think? (with a lot of shims) --- syntax_tree.moon | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'syntax_tree.moon') diff --git a/syntax_tree.moon b/syntax_tree.moon index d2f5d37..926ea09 100644 --- a/syntax_tree.moon +++ b/syntax_tree.moon @@ -6,7 +6,7 @@ unpack or= table.unpack AST = {} AST.is_syntax_tree = (n, t=nil)-> - type(n) == 'table' and getmetatable(n) and AST[n.type] == getmetatable(n) and (t == nil or n.type == t) + type(n) == 'table' and getmetatable(n) and getmetatable(n).__type == "Syntax Tree" and (t == nil or n.type == t) as_lua = => if type(@) == 'number' @@ -25,6 +25,7 @@ for name in *types .__index = cls .__name = name .type = name + .__type = "Syntax Tree" .is_instance = (x)=> getmetatable(x) == @ .__tostring = => bits = [tostring(b) for b in *@] -- cgit v1.2.3