public Object nextValue()

in flow/src/java/org/apache/struts/flow/json/JSONTokener.java [280:327]


    public Object nextValue() throws ParseException {
        char c = nextClean();
        String s;

        if (c == '"' || c == '\'') {
            return nextString(c);
        }
        if (c == '{') {
            back();
            return new JSONObject(this);
        }
        if (c == '[') {
            back();
            return new JSONArray(this);
        }
        StringBuffer sb = new StringBuffer();
        char b = c;
        while (c >= ' ' && c != ':' && c != ',' && c != ']' && c != '}' &&
                c != '/') {
            sb.append(c);
            c = next();
        }
        back();
        s = sb.toString().trim();
        if (s.equals("true")) {
            return Boolean.TRUE;
        }
        if (s.equals("false")) {
            return Boolean.FALSE;
        }
        if (s.equals("null")) {
            return JSONObject.NULL;
        }
        if ((b >= '0' && b <= '9') || b == '.' || b == '-' || b == '+') {
            try {
                return new Integer(s);
            } catch (Exception e) {
            }
            try {
                return new Double(s);
            } catch (Exception e) {
            }
        }
        if (s.equals("")) {
            throw syntaxError("Missing value.");
        }
        return s;
    }