示例#1
0
        internal JsonToken ReadNext()
        {
            reader.SkipWhitespace();

            if (reader.IsEof) return JsonToken.Eof;

            switch (reader.Current)
            {
                case '"': return ReadQuotedString();

                // Symbols
                case '['  : reader.Next(); return JsonToken.BracketOpen;  // Array start
                case ']'  : reader.Next(); return JsonToken.BracketClose; // Array end
                case ','  : reader.Next(); return JsonToken.Comma;        // Value seperator
                case ':'  : reader.Next(); return JsonToken.Colon;        // Field value indicator
                case '{'  : reader.Next(); return JsonToken.BraceOpen;    // Object start
                case '}'  : reader.Next(); return JsonToken.BraceClose;   // Object end
                case '\0' : reader.Next(); return JsonToken.Terminator;   // Stream terminiator

                default: return ReadLiteral();
            }
        }
示例#2
0
        internal JsonTokenizer(SourceReader reader)
        {
            this.reader = reader;

            reader.Next(); // Start with the first char
        }