end
defp section_body(:table, chunk) do
table_vec(chunk)
end
defp table_vec(chunk) do
{length, rest} = u32(chunk)
do_table_vec(length, rest)
end
defp do_table_vec(length, chunk) do
do_table_vec(length, chunk, [])
end
defp do_table_vec(0, chunk, acc) do
{acc |> Enum.reverse(), chunk}
end
defp do_table_vec(length, chunk, acc) do
{table, rest} = tabletype(chunk)
do_table_vec(length - 1, rest, [table | acc])
end
defp tabletype(chunk) do
{et, rest} = reftype(chunk)
{lim, rest} = limits(rest)
{{et, lim}, rest}