Ejemplo n.º 1
0
        private JSONValue ParseDict()
        {
            this.Next();
            this.SkipWs();
            Dictionary <string, JSONValue> dictionary = new Dictionary <string, JSONValue>();

            while (this.cur != '}')
            {
                JSONValue jSONValue = this.ParseValue();
                if (!jSONValue.IsString())
                {
                    throw new JSONParseException("Key not string type at " + this.PosMsg());
                }
                this.SkipWs();
                if (this.cur != ':')
                {
                    throw new JSONParseException("Missing dict entry delimiter ':' at " + this.PosMsg());
                }
                this.Next();
                dictionary.Add(jSONValue.AsString(), this.ParseValue());
                this.SkipWs();
                if (this.cur == ',')
                {
                    this.Next();
                    this.SkipWs();
                }
            }
            this.Next();
            return(new JSONValue(dictionary));
        }
Ejemplo n.º 2
0
        private JSONValue ParseDict()
        {
            Next();
            SkipWs();
            Dictionary <string, JSONValue> dict = new Dictionary <string, JSONValue>();

            while (cur != '}')
            {
                JSONValue key = ParseValue();
                if (!key.IsString())
                {
                    throw new JSONParseException("Key not string type at " + PosMsg());
                }
                SkipWs();
                if (cur != ':')
                {
                    throw new JSONParseException("Missing dict entry delimiter ':' at " + PosMsg());
                }
                Next();
                dict.Add(key.AsString(), ParseValue());
                SkipWs();
                if (cur == ',')
                {
                    Next();
                    SkipWs();
                }
            }
            Next();
            return(new JSONValue(dict));
        }
Ejemplo n.º 3
0
        private JSONValue ParseDict()
        {
            int num1 = (int)this.Next();

            this.SkipWs();
            Dictionary <string, JSONValue> dictionary = new Dictionary <string, JSONValue>();

            while ((int)this.cur != 125)
            {
                JSONValue jsonValue = this.ParseValue();
                if (!jsonValue.IsString())
                {
                    throw new JSONParseException("Key not string type at " + this.PosMsg());
                }
                this.SkipWs();
                if ((int)this.cur != 58)
                {
                    throw new JSONParseException("Missing dict entry delimiter ':' at " + this.PosMsg());
                }
                int num2 = (int)this.Next();
                dictionary.Add(jsonValue.AsString(), this.ParseValue());
                this.SkipWs();
                if ((int)this.cur == 44)
                {
                    int num3 = (int)this.Next();
                    this.SkipWs();
                }
            }
            int num4 = (int)this.Next();

            return(new JSONValue((object)dictionary));
        }