private String readStringInternal(boolean allowML) throws IOException { // callees make sure that (current=='"' || current=='\'') int exitCh = current; read(); startCapture(); while (current!=exitCh) { if (current=='\\') readEscape(); else if (current<0x20) throw expected("valid string character"); else read(); } String string=endCapture(); read(); if (allowML && exitCh=='\'' && current=='\'' && string.length()==0) { // ''' indicates a multiline string read(); return readMlString(); } else return string; }
private String readStringInternal(boolean allowML) throws IOException { // callees make sure that (current=='"' || current=='\'') int exitCh = current; read(); startCapture(); while (current!=exitCh) { if (current=='\\') readEscape(); else if (current<0x20) throw expected("valid string character"); else read(); } String string=endCapture(); read(); if (allowML && exitCh=='\'' && current=='\'' && string.length()==0) { // ''' indicates a multiline string read(); return readMlString(); } else return string; }
private JsonObject readObject(boolean objectWithoutBraces) throws IOException { if (!objectWithoutBraces) read(); JsonObject object=new JsonObject(); skipWhiteSpace(); while (true) { if (objectWithoutBraces) { if (isEndOfText()) break; } else { if (isEndOfText()) throw error("End of input while parsing an object (did you forget a closing '}'?)"); if (readIf('}')) break; } String name=readName(); skipWhiteSpace(); if (!readIf(':')) { throw expected("':'"); } skipWhiteSpace(); object.add(name, readValue()); skipWhiteSpace(); if (readIf(',')) skipWhiteSpace(); // , is optional } return object; }
private JsonObject readObject(boolean objectWithoutBraces) throws IOException { if (!objectWithoutBraces) read(); JsonObject object=new JsonObject(); skipWhiteSpace(); while (true) { if (objectWithoutBraces) { if (isEndOfText()) break; } else { if (isEndOfText()) throw error("End of input while parsing an object (did you forget a closing '}'?)"); if (readIf('}')) break; } String name=readName(); skipWhiteSpace(); if (!readIf(':')) { throw expected("':'"); } skipWhiteSpace(); object.add(name, readValue()); skipWhiteSpace(); if (readIf(',')) skipWhiteSpace(); // , is optional } return object; }