MCPcopy Create free account
hub / github.com/cschanck/single-file-java / singleObject

Method singleObject

src/main/java/org/sfj/JSONOne.java:827–849  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

825 }
826
827 public JObject singleObject() throws ParseException {
828 Token p = scanner.nextToken();
829 switch (p.type) {
830 case LEFT_BRACKET:
831 return array();
832 case LEFT_CURLY:
833 return map();
834 case FALSE:
835 return new JBoolean(false);
836 case TRUE:
837 return new JBoolean(true);
838 case NULL:
839 return new JNull();
840 case STRING:
841 return new JString((String) p.literal);
842 case NUMBER:
843 return new JNumber(nFormat.parse(p.lexeme));
844 case EOF:
845 return null;
846 default:
847 throw error(p, "Unexpected token");
848 }
849 }
850
851 private JMap map() throws ParseException {
852 JMap ret = new JMap();

Callers 10

testParseBooleanMethod · 0.95
testParseNumberMethod · 0.95
testParseStringMethod · 0.95
testParseNullMethod · 0.95
testSimpleArraysMethod · 0.95
testSimpleMapsMethod · 0.95
listOfMapEntriesMethod · 0.95
listOfArrayEntriesMethod · 0.95
testParseColorsMethod · 0.80
roundTripMethod · 0.80

Calls 5

arrayMethod · 0.95
mapMethod · 0.95
errorMethod · 0.95
nextTokenMethod · 0.80
parseMethod · 0.80

Tested by 8

testParseBooleanMethod · 0.76
testParseNumberMethod · 0.76
testParseStringMethod · 0.76
testParseNullMethod · 0.76
testSimpleArraysMethod · 0.76
testSimpleMapsMethod · 0.76
testParseColorsMethod · 0.64
roundTripMethod · 0.64