aboutsummaryrefslogtreecommitdiff
path: root/nomsu_decompiler.moon
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2018-11-09 19:32:13 -0800
committerBruce Hill <bruce@bruce-hill.com>2018-11-09 19:32:20 -0800
commit771007bc4dbcde1698fd86d87374df21651585a5 (patch)
treef97a5bcabb00c5736d5621f8b398fb63f61eb188 /nomsu_decompiler.moon
parentb5a5b7f90d576b0a926e9630a3efb1ebfd5539d7 (diff)
Fixed word clumping with linebreaks.
Diffstat (limited to 'nomsu_decompiler.moon')
-rw-r--r--nomsu_decompiler.moon11
1 files changed, 6 insertions, 5 deletions
diff --git a/nomsu_decompiler.moon b/nomsu_decompiler.moon
index 69d9d76..474d61f 100644
--- a/nomsu_decompiler.moon
+++ b/nomsu_decompiler.moon
@@ -209,11 +209,12 @@ tree_to_nomsu = (tree)->
for i,bit in ipairs tree
if type(bit) == "string"
- 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
+ if next_space == " "
+ clump_words = if type(tree[i-1]) == 'string'
+ is_operator(bit) != is_operator(tree[i-1])
+ else bit == "'"
+ next_space = "" if clump_words
+ nomsu\append next_space, bit
next_space = nomsu\trailing_line_len! > MAX_LINE and " \\\n.." or " "
else
bit_nomsu = recurse(bit)