aboutsummaryrefslogtreecommitdiff
path: root/nomsu_decompiler.lua
diff options
context:
space:
mode:
Diffstat (limited to 'nomsu_decompiler.lua')
-rw-r--r--nomsu_decompiler.lua20
1 files changed, 11 insertions, 9 deletions
diff --git a/nomsu_decompiler.lua b/nomsu_decompiler.lua
index b6cb659..17ac7eb 100644
--- a/nomsu_decompiler.lua
+++ b/nomsu_decompiler.lua
@@ -281,16 +281,18 @@ tree_to_nomsu = function(tree)
end
for i, bit in ipairs(tree) do
if type(bit) == "string" then
- 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(" ")
+ if next_space == " " then
+ 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 clump_words then
+ next_space = ""
+ end
end
- nomsu:append(bit)
+ nomsu:append(next_space, bit)
next_space = nomsu:trailing_line_len() > MAX_LINE and " \\\n.." or " "
else
local bit_nomsu = recurse(bit)