aboutsummaryrefslogtreecommitdiff
path: root/nomsu_compiler.moon
diff options
context:
space:
mode:
authorBruce Hill <bitbucket@bruce-hill.com>2018-07-22 14:57:37 -0700
committerBruce Hill <bitbucket@bruce-hill.com>2018-07-22 14:57:56 -0700
commit4fa9757fa27d79a0cda399dcf3b711f4d0d60457 (patch)
treea67d210b87912ac023822b3e69c97c406659e139 /nomsu_compiler.moon
parent0fe94570b5c33e01472f61fcd564809f93e1b08a (diff)
Better handling of parsing non-filechunks text.
Diffstat (limited to 'nomsu_compiler.moon')
-rw-r--r--nomsu_compiler.moon5
1 files changed, 3 insertions, 2 deletions
diff --git a/nomsu_compiler.moon b/nomsu_compiler.moon
index afea8ae..12503f2 100644
--- a/nomsu_compiler.moon
+++ b/nomsu_compiler.moon
@@ -667,7 +667,7 @@ with NomsuCompiler
elseif setup and not (line.type == "Action" and line.stub == "use %")
nomsu\append "\n", pop_comments(line.source.start)
setup = false
- nomsu\append pop_comments(line.source.start, '\n')
+ nomsu\append pop_comments(line.source.start, tostring(nomsu)\match("\n\n$") and "" or "\n")
line_nomsu = @tree_to_nomsu(line, pop_comments)
nomsu\append line_nomsu
nomsu\append(line_nomsu\is_multiline! and "\n\n" or "\n") if line_no < #chunk
@@ -676,6 +676,7 @@ with NomsuCompiler
nomsu\append recurse(chunk)
setup = false
nomsu\append pop_comments(tree.source.stop, '\n')
+ nomsu\append('\n') unless tostring(nomsu)\match("\n$")
return nomsu
when "Action"
@@ -717,7 +718,7 @@ with NomsuCompiler
line_nomsu = recurse(line)
nomsu\append line_nomsu
if i < #tree
- nomsu\append(line_nomsu\is_multiline! and "\n\n" or "\n")
+ nomsu\append(tostring(line_nomsu)\match('\n[^\n]*\n') and "\n\n" or "\n")
nomsu\append pop_comments(tree.source.stop, '\n')
return NomsuCode(tree.source, ":\n ", nomsu)