/** * Consume the next character, and check that it matches a specified * character. * @param c The character to match. * @return The character. * @throws JSONException if the character does not match. */ public char next(char c) throws JSONException { char n= next(); if (n != c) { throw syntaxError("Expected '" + c + "' and instead saw '" + n + "'"); } return n; }
throw syntaxError("Substring bounds error");
case '\n': case '\r': throw syntaxError("Unterminated string"); case '\\': c= next();
throw syntaxError("A JSONObject text must begin with '{'"); throw syntaxError("A JSONObject text must end with '}'"); case '}': return jsonObject; throw syntaxError("Expected a ':' after a key"); return jsonObject; default: throw syntaxError("Expected a ',' or '}'");
throw syntaxError("A JSONArray text must start with '['"); if (q != c) throw syntaxError("Expected a '" + q + "'"); throw syntaxError("Expected a ',' or ']'");
if (s.equals("")) throw syntaxError("Missing value");