YamlDotNet.Core.Parser.ParseBlockMappingKey C# (CSharp) Method

ParseBlockMappingKey() private method

Parse the productions: block_mapping ::= BLOCK-MAPPING_START ******************* ((KEY block_node_or_indentless_sequence?)? *** * (VALUE block_node_or_indentless_sequence?)?)* BLOCK-END *********
private ParseBlockMappingKey ( bool isFirst ) : YamlDotNet.Core.Events.ParsingEvent
isFirst bool
return YamlDotNet.Core.Events.ParsingEvent
        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.");
            }
        }