aboutsummaryrefslogtreecommitdiff
path: root/nomsu_compiler.moon
diff options
context:
space:
mode:
authorBruce Hill <bitbucket@bruce-hill.com>2018-09-10 16:29:04 -0700
committerBruce Hill <bitbucket@bruce-hill.com>2018-09-10 16:29:17 -0700
commit989e133a5798850a9778bc6db8d07c2e5a274893 (patch)
tree5c331397aac22ea8a1c27f51fa550420d6b64bb7 /nomsu_compiler.moon
parent7c6047254e5aa7ce5a0667b14676b22a7447f956 (diff)
Fixed tree_to_nomsu for method calls that span lines.
Diffstat (limited to 'nomsu_compiler.moon')
-rw-r--r--nomsu_compiler.moon13
1 files changed, 12 insertions, 1 deletions
diff --git a/nomsu_compiler.moon b/nomsu_compiler.moon
index ba911ce..6afc38a 100644
--- a/nomsu_compiler.moon
+++ b/nomsu_compiler.moon
@@ -675,7 +675,18 @@ with NomsuCompiler
pos, next_space = tree.source.start, ''
nomsu = NomsuCode(tree.source, pop_comments(pos))
if tree.target
- nomsu\append @tree_to_nomsu(tree.target), "::"
+ if tree.target.type == "Block"
+ nomsu\append(recurse(tree.target, #nomsu\match('[^\n]*$')))
+ pos = tree.target.source.stop
+ next_space = inline and "::" or "\n..::"
+ else
+ target_nomsu = recurse(tree.target, #nomsu\match('[^\n]*$'))
+ if tree.target.type == "Action" and not target_nomsu\is_multiline!
+ target_nomsu\parenthesize!
+ nomsu\append target_nomsu
+ pos = tree.target.source.stop
+ next_space = target_nomsu\is_multiline! and "\n..::" or "::"
+
for i,bit in ipairs tree
if next_space == "\n.." or (next_space == " " and nomsu\trailing_line_len! > MAX_LINE)
nomsu\append "\n", pop_comments(pos), '..'