internal bool StartTable(TableSpec spec, List<Block> lines)
{
// Mustn't have more than 1 preceeding line
if (lines.Count > 1)
return false;
// Rewind, parse the header row then fast forward back to current pos
if (lines.Count == 1)
{
int savepos = position;
position = lines[0].lineStart;
spec.Headers = spec.ParseRow(this);
if (spec.Headers == null)
return false;
position = savepos;
lines.Clear();
}
// Parse all rows
while (true)
{
int savepos = position;
var row = spec.ParseRow(this);
if (row != null)
{
spec.Rows.Add(row);
continue;
}
position = savepos;
break;
}
return true;
}