From 7762c8c45b6f0349d769682b26349fb25a7a8657 Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Mon, 31 Dec 2018 01:36:48 -0800 Subject: Added the ": for $ in $: ..." shorthand for indented comprehensions. --- nomsu_decompiler.lua | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'nomsu_decompiler.lua') diff --git a/nomsu_decompiler.lua b/nomsu_decompiler.lua index e17f25e..1918ac2 100644 --- a/nomsu_decompiler.lua +++ b/nomsu_decompiler.lua @@ -562,6 +562,12 @@ tree_to_nomsu = function(tree) if i > 1 then sep = '\n' end + elseif item.type == 'Block' and #item == 1 then + item_nomsu = tree_to_nomsu(item[1]) + item_nomsu:prepend(": ") + if i > 1 then + sep = '\n' + end else item_nomsu = tree_to_inline_nomsu(item) if #item_nomsu:text() > MAX_LINE then @@ -573,7 +579,7 @@ tree_to_nomsu = function(tree) end nomsu:add(sep) nomsu:add(item_nomsu) - if item_nomsu:is_multiline() or item.type == 'Comment' or nomsu:trailing_line_len() + #tostring(item_nomsu) >= MAX_LINE then + if item_nomsu:is_multiline() or item.type == 'Comment' or item.type == "Block" or nomsu:trailing_line_len() + #tostring(item_nomsu) >= MAX_LINE then sep = '\n' else sep = ', ' -- cgit v1.2.3