aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruce Hill <bitbucket@bruce-hill.com>2018-04-28 20:45:17 -0700
committerBruce Hill <bitbucket@bruce-hill.com>2018-04-28 20:45:27 -0700
commitbf24824660497189da1a7d03b524e648271b4d03 (patch)
tree28a1b10e27fc7037bc217ed51e9c076abca52eb5
parent85c5511fa5ef9df0520fe71c75d4931de065b468 (diff)
Improving idiomatic nomsu codegen
-rw-r--r--nomsu_tree.lua9
-rw-r--r--nomsu_tree.moon5
2 files changed, 12 insertions, 2 deletions
diff --git a/nomsu_tree.lua b/nomsu_tree.lua
index c2d409e..93588c4 100644
--- a/nomsu_tree.lua
+++ b/nomsu_tree.lua
@@ -326,7 +326,14 @@ Tree("Action", {
nomsu:append(next_space, bit.value)
next_space = " "
else
- local arg_nomsu = bit.type ~= "Block" and bit:as_nomsu(true)
+ local arg_nomsu
+ if last_colon == i - 1 and bit.type == "Action" then
+ arg_nomsu = nil
+ elseif bit.type == "Block" then
+ arg_nomsu = nil
+ else
+ arg_nomsu = bit:as_nomsu(true)
+ end
if arg_nomsu and #arg_nomsu < MAX_LINE then
if bit.type == "Action" then
if can_use_colon and i > 1 then
diff --git a/nomsu_tree.moon b/nomsu_tree.moon
index 28f7acf..2b4cc0a 100644
--- a/nomsu_tree.moon
+++ b/nomsu_tree.moon
@@ -192,7 +192,10 @@ Tree "Action",
nomsu\append next_space, bit.value
next_space = " "
else
- arg_nomsu = bit.type != "Block" and bit\as_nomsu(true)
+ arg_nomsu = if last_colon == i-1 and bit.type == "Action" then nil
+ elseif bit.type == "Block" then nil
+ else bit\as_nomsu(true)
+
if arg_nomsu and #arg_nomsu < MAX_LINE
if bit.type == "Action"
if can_use_colon and i > 1