correctly check types, issue from DelayedLine

This commit is contained in:
leaf corcoran 2013-01-11 10:06:03 -08:00
parent 54dc8efa0b
commit 19032214a8
2 changed files with 12 additions and 4 deletions

View File

@ -66,9 +66,11 @@ do
if "string" == _exp_0 or DelayedLine == _exp_0 then
line_no = line_no + 1
out[line_no] = posmap[i]
elseif "table" == _exp_0 then
elseif Lines == _exp_0 then
local _
_, line_no = l:flatten_posmap(line_no, out)
else
error("Unknown item in Lines: " .. tostring(l))
end
end
return out, line_no
@ -101,8 +103,10 @@ do
end
insert(buffer, "\n")
local last = l
elseif "table" == _exp_0 then
elseif Lines == _exp_0 then
l:flatten(indent and indent .. indent_char or indent_char, buffer)
else
error("Unknown item in Lines: " .. tostring(l))
end
end
return buffer

View File

@ -45,8 +45,10 @@ class Lines
when "string", DelayedLine
line_no += 1
out[line_no] = posmap[i]
when "table"
when Lines
_, line_no = l\flatten_posmap line_no, out
else
error "Unknown item in Lines: #{l}"
out, line_no
@ -72,8 +74,10 @@ class Lines
insert buffer, "\n"
last = l
when "table" -- Lines
when Lines
l\flatten indent and indent .. indent_char or indent_char, buffer
else
error "Unknown item in Lines: #{l}"
buffer
__tostring: =>