Ejemplo n.º 1
0
        private JsonToken ParseNextMember()
        {
            switch (NextClean())
            {
            case ';':
            case ',':
            {
                if (NextClean() == '}')
                {
                    return(Yield(JsonToken.EndObject()));
                }
                break;
            }

            case '}':
                return(Yield(JsonToken.EndObject()));

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

            _reader.Back();
            string name = Parse().Text;

            return(Yield(JsonToken.Member(name), ParseObjectMemberValueMethod));
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Parses the first member name of the object or the end of the array
        /// in case of an empty object.
        /// </summary>

        private JsonToken ParseObjectMember()
        {
            char ch = NextClean();

            if (ch == '}')
            {
                return(Yield(JsonToken.EndObject()));
            }

            if (ch == BufferedCharReader.EOF)
            {
                throw new JsonException("An object must end with '}'.");
            }

            _reader.Back();
            string name = Parse().Text;

            return(Yield(JsonToken.Member(name), ParseObjectMemberValueMethod));
        }
Ejemplo n.º 3
0
 protected override void WriteMemberImpl(string name)
 {
     Write(JsonToken.Member(name));
 }