@Test public final void testDecodeString() { JSONDecoder decoder = new JSONDecoder("\"hello, its \\\"ME\\\" again!\""); JSONValue result = decoder.decode(); TestCase.assertEquals("\"hello, its \\\"ME\\\" again!\"",result.toJSON()); }
private JSONString decodeString() { StringBuilder result = new StringBuilder(); while(reader.current()==' ') { reader.next(); } if(reader.current() == Opener.STRING.sign) { while(reader.next()) { char temp = reader.current(); if(Opener.STRING.sign == temp) { if(CONTROL != reader.readBefore()) { break; } } result.append(temp); } } else { return new JSONString(""); } return new JSONString(result.toString()); }
JSONDecoder { private JSONString decodeString() { StringBuilder result = new StringBuilder(); while(reader.current()==' ') { reader.next(); } if(reader.current() == Opener.STRING.sign) { while(reader.next()) { char temp = reader.current(); if(Opener.STRING.sign == temp) { if(CONTROL != reader.readBefore()) { break; } } result.append(temp); } } else { return new JSONString(""); } return new JSONString(result.toString()); } }
JSONDecoder { private JSONString decodeString() { StringBuilder result = new StringBuilder(); while(reader.current()==' ') { reader.next(); } if(reader.current() == Opener.STRING.sign) { while(reader.next()) { char temp = reader.current(); if(Opener.STRING.sign == temp) { if(CONTROL != reader.readBefore()) { break; } } result.append(temp); } } else { return new JSONString(""); } return new JSONString(result.toString()); } JSONDecoder(final String json); }
JSONDecoder { private JSONString decodeString() { StringBuilder result = new StringBuilder(); while(reader.current()==' ') { reader.next(); } if(reader.current() == Opener.STRING.sign) { while(reader.next()) { char temp = reader.current(); if(Opener.STRING.sign == temp) { if(CONTROL != reader.readBefore()) { break; } } result.append(temp); } } else { return new JSONString(""); } return new JSONString(result.toString()); } JSONDecoder(final String json); JSONValue decode(); }
JSONDecoder { private JSONString decodeString() { StringBuilder result = new StringBuilder(); while(reader.current()==' ') { reader.next(); } if(reader.current() == Opener.STRING.sign) { while(reader.next()) { char temp = reader.current(); if(Opener.STRING.sign == temp) { if(CONTROL != reader.readBefore()) { break; } } result.append(temp); } } else { return new JSONString(""); } return new JSONString(result.toString()); } JSONDecoder(final String json); JSONValue decode();  }