private ParsingEvent ParseBlockMappingKey(bool isFirst)
{
if (isFirst)
{
GetCurrentToken();
Skip();
}
if (GetCurrentToken() is Key)
{
Mark mark = GetCurrentToken().End;
Skip();
if (!(GetCurrentToken() is Key || GetCurrentToken() is Value || GetCurrentToken() is BlockEnd))
{
states.Push(ParserState.BlockMappingValue);
return ParseNode(true, true);
}
else
{
state = ParserState.BlockMappingValue;
return ProcessEmptyScalar(mark);
}
}
else if (GetCurrentToken() is BlockEnd)
{
state = states.Pop();
ParsingEvent evt = new Events.MappingEnd(GetCurrentToken().Start, GetCurrentToken().End);
Skip();
return evt;
}
else
{
var current = GetCurrentToken();
throw new SemanticErrorException(current.Start, current.End, "While parsing a block mapping, did not find expected key.");
}
}