private JsonValue readString() throws IOException { return new JsonString(readStringInternal(true)); }
private JsonValue readString() throws IOException { return new JsonString(readStringInternal(true)); }
private String readName() throws IOException { if (current=='"' || current=='\'') return readStringInternal(false); StringBuilder name=new StringBuilder(); int space=-1, start=index; while (true) { if (current==':') { if (name.length()==0) throw error("Found ':' but no key name (for an empty key name use quotes)"); else if (space>=0 && space!=name.length()) { index=start+space; throw error("Found whitespace in your key name (use quotes to include)"); } return name.toString(); } else if (isWhiteSpace(current)) { if (space<0) space=name.length(); } else if (current<' ') { throw error("Name is not closed"); } else if (JsonValue.isPunctuatorChar(current)) { throw error("Found '" + (char)current + "' where a key name was expected (check your syntax or use quotes if the key name includes {}[],: or whitespace)"); } else name.append((char)current); read(); } }
private String readName() throws IOException { if (current=='"' || current=='\'') return readStringInternal(false); StringBuilder name=new StringBuilder(); int space=-1, start=index; while (true) { if (current==':') { if (name.length()==0) throw error("Found ':' but no key name (for an empty key name use quotes)"); else if (space>=0 && space!=name.length()) { index=start+space; throw error("Found whitespace in your key name (use quotes to include)"); } return name.toString(); } else if (isWhiteSpace(current)) { if (space<0) space=name.length(); } else if (current<' ') { throw error("Name is not closed"); } else if (JsonValue.isPunctuatorChar(current)) { throw error("Found '" + (char)current + "' where a key name was expected (check your syntax or use quotes if the key name includes {}[],: or whitespace)"); } else name.append((char)current); read(); } }