Пример #1
0
        /// <summary>
        /// Consumes input till assignment is met or till end of pair is found.
        /// Everything else is reported as unexpected character.
        /// </summary>
        /// <returns>If was able to find assignment.</returns>
        private bool ConsumeTillAssignment()
        {
            var c = _input.Next;

            while (c != ':' && c != '=')
            {
                if (c == -1)
                {
                    return(false);
                }

                if (_input.ConsumeSpaces())
                {
                }
                else if (c.IsNewLineCharacter())
                {
                    if (_wsaStack.Count > 0)
                    {
                        _input.ConsumeNewLine();
                        ConsumeLeadingSpacesInWsa();
                    }
                    else
                    {
                        return(false);
                    }
                }
                else if (c == ')' || _processJsonBrackets && (c == '}' || c == ']'))
                {
                    if (_wsaStack.Count > 0)
                    {
                        return(false);
                    }
                    _input.Consume();
                    ReportUnexpectedCharacter(c);
                }
                else
                {
                    return(false);
                }
                c = _input.Next;
            }
            return(true);
        }