YamlDotNet.Core.Parser.ParseFlowMappingKey C# (CSharp) Méthode

ParseFlowMappingKey() private méthode

Parse the productions: flow_mapping ::= FLOW-MAPPING-START ****************** (flow_mapping_entry FLOW-ENTRY)* * ********** flow_mapping_entry? ****************** FLOW-MAPPING-END **************** flow_mapping_entry ::= flow_node | KEY flow_node? (VALUE flow_node?)? * *** *
private ParseFlowMappingKey ( bool isFirst ) : YamlDotNet.Core.Events.ParsingEvent
isFirst bool
Résultat YamlDotNet.Core.Events.ParsingEvent
        private ParsingEvent ParseFlowMappingKey(bool isFirst)
        {
            if (isFirst)
            {
                GetCurrentToken();
                Skip();
            }

            if (!(GetCurrentToken() is FlowMappingEnd))
            {
                if (!isFirst)
                {
                    if (GetCurrentToken() is FlowEntry)
                    {
                        Skip();
                    }
                    else
                    {
                        var current = GetCurrentToken();
                        throw new SemanticErrorException(current.Start, current.End, "While parsing a flow mapping,  did not find expected ',' or '}'.");
                    }
                }

                if (GetCurrentToken() is Key)
                {
                    Skip();

                    if (!(GetCurrentToken() is Value || GetCurrentToken() is FlowEntry || GetCurrentToken() is FlowMappingEnd))
                    {
                        states.Push(ParserState.FlowMappingValue);
                        return ParseNode(false, false);
                    }
                    else
                    {
                        state = ParserState.FlowMappingValue;
                        return ProcessEmptyScalar(GetCurrentToken().Start);
                    }
                }
                else if (!(GetCurrentToken() is FlowMappingEnd))
                {
                    states.Push(ParserState.FlowMappingEmptyValue);
                    return ParseNode(false, false);
                }
            }

            state = states.Pop();
            ParsingEvent evt = new Events.MappingEnd(GetCurrentToken().Start, GetCurrentToken().End);
            Skip();
            return evt;
        }