diff options
| author | Bruce Hill <bitbucket@bruce-hill.com> | 2018-07-22 14:57:37 -0700 |
|---|---|---|
| committer | Bruce Hill <bitbucket@bruce-hill.com> | 2018-07-22 14:57:56 -0700 |
| commit | 4fa9757fa27d79a0cda399dcf3b711f4d0d60457 (patch) | |
| tree | a67d210b87912ac023822b3e69c97c406659e139 /nomsu_compiler.lua | |
| parent | 0fe94570b5c33e01472f61fcd564809f93e1b08a (diff) | |
Better handling of parsing non-filechunks text.
Diffstat (limited to 'nomsu_compiler.lua')
| -rw-r--r-- | nomsu_compiler.lua | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/nomsu_compiler.lua b/nomsu_compiler.lua index 16874a3..ac33eb2 100644 --- a/nomsu_compiler.lua +++ b/nomsu_compiler.lua @@ -1062,7 +1062,7 @@ do nomsu:append("\n", pop_comments(line.source.start)) setup = false end - nomsu:append(pop_comments(line.source.start, '\n')) + nomsu:append(pop_comments(line.source.start, tostring(nomsu):match("\n\n$") and "" or "\n")) local line_nomsu = self:tree_to_nomsu(line, pop_comments) nomsu:append(line_nomsu) if line_no < #chunk then @@ -1076,6 +1076,9 @@ do setup = false end nomsu:append(pop_comments(tree.source.stop, '\n')) + if not (tostring(nomsu):match("\n$")) then + nomsu:append('\n') + end return nomsu elseif "Action" == _exp_0 then local pos, next_space = tree.source.start, '' @@ -1117,7 +1120,7 @@ do local line_nomsu = recurse(line) nomsu:append(line_nomsu) if i < #tree then - 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") end end nomsu:append(pop_comments(tree.source.stop, '\n')) |
