aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2018-11-09 17:53:21 -0800
committerBruce Hill <bruce@bruce-hill.com>2018-11-09 17:53:30 -0800
commitb5a5b7f90d576b0a926e9630a3efb1ebfd5539d7 (patch)
tree624ae920af5044fed0ca15810f21576c426a0c69
parent63c14bdbc3afbb3819c0f6ca4435cff1179f68f0 (diff)
Fixed other place for clumping "'"
-rw-r--r--nomsu_decompiler.lua10
-rw-r--r--nomsu_decompiler.moon6
2 files changed, 12 insertions, 4 deletions
diff --git a/nomsu_decompiler.lua b/nomsu_decompiler.lua
index bfa700a..b6cb659 100644
--- a/nomsu_decompiler.lua
+++ b/nomsu_decompiler.lua
@@ -281,8 +281,14 @@ tree_to_nomsu = function(tree)
end
for i, bit in ipairs(tree) do
if type(bit) == "string" then
- if not (next_space == " " and (type(tree[i - 1]) == 'string' and is_operator(tree[i - 1]) ~= is_operator(bit))) then
- nomsu:append(next_space)
+ local clump_words
+ if type(tree[i - 1]) == 'string' then
+ clump_words = is_operator(bit) ~= is_operator(tree[i - 1])
+ else
+ clump_words = bit == "'"
+ end
+ if i > 1 and not clump_words then
+ nomsu:append(" ")
end
nomsu:append(bit)
next_space = nomsu:trailing_line_len() > MAX_LINE and " \\\n.." or " "
diff --git a/nomsu_decompiler.moon b/nomsu_decompiler.moon
index 750ccb5..69d9d76 100644
--- a/nomsu_decompiler.moon
+++ b/nomsu_decompiler.moon
@@ -209,8 +209,10 @@ tree_to_nomsu = (tree)->
for i,bit in ipairs tree
if type(bit) == "string"
- unless next_space == " " and (type(tree[i-1]) == 'string' and is_operator(tree[i-1]) != is_operator(bit))
- nomsu\append next_space
+ clump_words = if type(tree[i-1]) == 'string'
+ is_operator(bit) != is_operator(tree[i-1])
+ else bit == "'"
+ nomsu\append " " if i > 1 and not clump_words
nomsu\append bit
next_space = nomsu\trailing_line_len! > MAX_LINE and " \\\n.." or " "
else