private int ScanVersionDirectiveNumber(Mark start)
{
int value = 0;
int length = 0;
// Repeat while the next character is digit.
while (analyzer.IsDigit())
{
// Check if the number is too long.
if (++length > MaxVersionNumberLength)
{
throw new SyntaxErrorException(start, cursor.Mark(), "While scanning a %YAML directive, find extremely long version number.");
}
value = value * 10 + analyzer.AsDigit();
Skip();
}
// Check if the number was present.
if (length == 0)
{
throw new SyntaxErrorException(start, cursor.Mark(), "While scanning a %YAML directive, did not find expected version number.");
}
return value;
}