public String nextToken () throws JSONException {
        char c;
        char q;
        StringBuffer sb = new StringBuffer();
        do {
            c = next();
        } while (Character.isWhitespace(c));
        if (c == '"' || c == '\'') {
            q = c;
            for (;;) {
                c = next();
                if (c < ' ') { throw syntaxError("Unterminated string."); }
                if (c == q) { return sb.toString(); }
                sb.append(c);
            }
        }
        for (;;) {
            if (c == 0 || Character.isWhitespace(c)) { return sb.toString(); }
            sb.append(c);
            c = next();
        }
    }