public WhitespaceMorsel Eat(string line, int lineCnt)
{
var trim = TrimLeadingSpaces(line, lineCnt);
if(whitespaceType == 'a')
{
whitespaceType = trim.WhitespaceType;
}
else if (whitespaceType != trim.WhitespaceType && trim.WhitespaceType != 'a')
{
throw new InconsistentWhitespaceException(string.Format("Some lines start with spaces, and some start with tabs"));
}
var indents = Indents(trim.Trimmed, lineCnt);
var back = new WhitespaceMorsel() {
Line = trim.Line,
Indents = indents,
DeltaIndents = indents - openIndents
};
if(back.DeltaIndents > 1)
throw new InconsistentWhitespaceException(string.Format("Line {0} increases too many tabbing levels at once.",lineCnt));
openIndents = indents;
return back;
}