aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--nomsu_decompiler.lua2
-rw-r--r--nomsu_decompiler.moon2
-rw-r--r--syntax_tree.lua2
-rw-r--r--syntax_tree.moon3
4 files changed, 4 insertions, 5 deletions
diff --git a/nomsu_decompiler.lua b/nomsu_decompiler.lua
index 5a7cc02..8e94df8 100644
--- a/nomsu_decompiler.lua
+++ b/nomsu_decompiler.lua
@@ -186,7 +186,7 @@ tree_to_inline_nomsu = function(tree)
elseif "IndexChain" == _exp_0 then
local nomsu = NomsuCode:from(tree.source)
for i, bit in ipairs(tree) do
- if i > 1 then
+ if i > 1 and bit.type ~= "Index" then
nomsu:add(".")
end
local bit_nomsu
diff --git a/nomsu_decompiler.moon b/nomsu_decompiler.moon
index b54553d..181d73f 100644
--- a/nomsu_decompiler.moon
+++ b/nomsu_decompiler.moon
@@ -139,7 +139,7 @@ tree_to_inline_nomsu = (tree)->
when "IndexChain"
nomsu = NomsuCode\from(tree.source)
for i, bit in ipairs tree
- nomsu\add "." if i > 1
+ nomsu\add "." if i > 1 and bit.type != "Index"
local bit_nomsu
bit_nomsu = if i > 1 and bit.type == "Text" and #bit == 1 and type(bit[1]) == 'string' and is_identifier(bit[1])
bit[1]
diff --git a/syntax_tree.lua b/syntax_tree.lua
index 702cba6..a091e86 100644
--- a/syntax_tree.lua
+++ b/syntax_tree.lua
@@ -202,7 +202,6 @@ do
})
_base_0.__class = _class_0
local self = _class_0
- self.__type = "Syntax Tree"
self.source_code_for_tree = setmetatable({ }, {
__index = function(self, t)
local s = t.source
@@ -217,6 +216,7 @@ do
end
SyntaxTree = _class_0
end
+SyntaxTree.__base.__type = "Syntax Tree"
getmetatable(SyntaxTree).__call = function(self, t)
if type(t.source) == 'string' then
t.source = Source:from_string(t.source)
diff --git a/syntax_tree.moon b/syntax_tree.moon
index d9f9da1..2579fad 100644
--- a/syntax_tree.moon
+++ b/syntax_tree.moon
@@ -16,8 +16,6 @@ as_lua = =>
--types = {"Number", "Var", "Block", "EscapedNomsu", "Text", "List", "Dict", "DictEntry",
-- "IndexChain", "Action", "FileChunks", "Error", "Comment"}
class SyntaxTree
- @__type: "Syntax Tree"
-
__tostring: =>
bits = [type(b) == 'string' and b\as_lua! or tostring(b) for b in *@]
for k,v in pairs(@)
@@ -104,6 +102,7 @@ class SyntaxTree
@is_instance: (t)=>
type(t) == 'table' and getmetatable(t) == @__base
+SyntaxTree.__base.__type = "Syntax Tree"
getmetatable(SyntaxTree).__call = (t)=>
if type(t.source) == 'string'