コード例 #1
0
        /// <summary>
        /// Parses the next element in the array.
        /// </summary>

        private JsonToken ParseArrayNext()
        {
            switch (NextClean())
            {
            case ';':
            case ',':
            {
                if (NextClean() == ']')
                {
                    return(Yield(JsonToken.EndArray()));
                }
                else
                {
                    _reader.Back();
                }

                break;
            }

            case ']':
            {
                return(Yield(JsonToken.EndArray()));
            }

            default:
                throw new JsonException("Expected a ',' or ']'.");
            }

            Push(ParseArrayNextMethod);
            return(Parse());
        }
コード例 #2
0
        /// <summary>
        /// Parses the first element of an array or the end of the array if
        /// it is empty.
        /// </summary>

        private JsonToken ParseArrayFirst()
        {
            if (NextClean() == ']')
            {
                return(Yield(JsonToken.EndArray()));
            }

            _reader.Back();

            Push(ParseArrayNextMethod);
            return(Parse());
        }
コード例 #3
0
 protected override void WriteEndArrayImpl()
 {
     Write(JsonToken.EndArray());
 }