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

View File

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