private int ScanBlockScalarBreaks(int currentIndent, StringBuilder breaks, Mark start, ref Mark end)
{
int maxIndent = 0;
end = cursor.Mark();
// Eat the intendation spaces and line breaks.
for (;;)
{
// Eat the intendation spaces.
while ((currentIndent == 0 || cursor.LineOffset < currentIndent) && analyzer.IsSpace())
{
Skip();
}
if (cursor.LineOffset > maxIndent)
{
maxIndent = cursor.LineOffset;
}
// Check for a tab character messing the intendation.
if ((currentIndent == 0 || cursor.LineOffset < currentIndent) && analyzer.IsTab())
{
throw new SyntaxErrorException(start, cursor.Mark(), "While scanning a block scalar, find a tab character where an intendation space is expected.");
}
// Have we find a non-empty line?
if (!analyzer.IsBreak())
{
break;
}
// Consume the line break.
breaks.Append(ReadLine());
end = cursor.Mark();
}
// Determine the indentation level if needed.
if (currentIndent == 0)
{
currentIndent = Math.Max(maxIndent, Math.Max(indent + 1, 1));
}
return currentIndent;
}