IDictionary <string, object> ParseObject()
        {
         #if USE_ARRAY_DICT
            var table = new ArrayDict();
         #else
            var table = new Dictionary <string, object>();
         #endif

            // ditch opening brace
            _pos++;

            // {
            while (true)
            {
                switch (NextToken())
                {
                case TOKEN.NONE:
                    return(null);

                case TOKEN.COMMA:
                    continue;

                case TOKEN.CURLY_CLOSE:
                    return(table);

                default:
                    // name
                    string name = ParseString(true);
                    if (name == null)
                    {
                        return(null);
                    }

                    // :
                    if (NextToken() != TOKEN.COLON)
                    {
                        return(null);
                    }
                    // ditch the colon
                    _pos++;

                    // value
               #if USE_ARRAY_DICT
                    table.AddUnchecked(name, ParseValue());
               #else
                    table.Add(name, ParseValue());
               #endif
                    break;
                }
            }
        }
Exemplo n.º 2
0
 internal Enumerator(ArrayDict dict)
 {
     _dict  = dict;
     _index = -1;
 }