From 4fa9757fa27d79a0cda399dcf3b711f4d0d60457 Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Sun, 22 Jul 2018 14:57:37 -0700 Subject: Better handling of parsing non-filechunks text. --- nomsu_compiler.moon | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'nomsu_compiler.moon') 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) -- cgit v1.2.3