Cleaning up clumping logic a little.

This commit is contained in:
Bruce Hill 2018-07-30 15:12:11 -07:00
parent ab4ebdf175
commit 4f53ea5cc4
2 changed files with 4 additions and 8 deletions

View File

@ -1048,7 +1048,7 @@ do
local nomsu = NomsuCode(tree.source, pop_comments(tree.source.start))
local should_clump
should_clump = function(prev_line, line)
if prev_line and prev_line.type == "Action" and line.type == "Action" then
if prev_line.type == "Action" and line.type == "Action" then
if prev_line.stub == "use %" then
return line.stub == "use %"
end
@ -1058,11 +1058,8 @@ do
if line.stub == "test %" then
return false
end
if recurse(prev_line):is_multiline() then
return false
end
end
return true
return not recurse(prev_line):is_multiline()
end
for chunk_no, chunk in ipairs(tree) do
if chunk_no > 1 then

View File

@ -650,12 +650,11 @@ with NomsuCompiler
when "FileChunks"
nomsu = NomsuCode(tree.source, pop_comments(tree.source.start))
should_clump = (prev_line, line)->
if prev_line and prev_line.type == "Action" and line.type == "Action"
if prev_line.type == "Action" and line.type == "Action"
if prev_line.stub == "use %" then return line.stub == "use %"
if prev_line.stub == "test %" then return true
if line.stub == "test %" then return false
return false if recurse(prev_line)\is_multiline!
return true
return not recurse(prev_line)\is_multiline!
for chunk_no, chunk in ipairs tree
nomsu\append "\n\n#{("~")\rep(80)}\n\n" if chunk_no > 1
nomsu\append pop_comments(chunk.source.start)