public Object parse(Object fieldName) { finalJSONLexerlexer=this.lexer; switch (lexer.token()) { case SET://值为int 21 lexer.nextToken(); HashSet<Object> set = newHashSet<Object>(); parseArray(set, fieldName); return set; case TREE_SET://22 lexer.nextToken(); TreeSet<Object> treeSet = newTreeSet<Object>(); parseArray(treeSet, fieldName); return treeSet; case LBRACKET://值为14 [ JSONArrayarray=newJSONArray(); parseArray(array, fieldName); if (lexer.isEnabled(Feature.UseObjectArray)) { return array.toArray(); } return array; case LBRACE://{ JSONObjectobject=newJSONObject(lexer.isEnabled(Feature.OrderedField)); return parseObject(object, fieldName); case LITERAL_INT://2 NumberintValue= lexer.integerValue(); lexer.nextToken(); return intValue; case LITERAL_FLOAT://3 Objectvalue= lexer.decimalValue(lexer.isEnabled(Feature.UseBigDecimal)); lexer.nextToken(); return value; case LITERAL_STRING://4 StringstringLiteral= lexer.stringVal(); lexer.nextToken(JSONToken.COMMA);
if (lexer.isEnabled(Feature.AllowISO8601DateFormat)) { JSONScanneriso8601Lexer=newJSONScanner(stringLiteral); try { if (iso8601Lexer.scanISO8601DateIfMatch()) { return iso8601Lexer.getCalendar().getTime(); } } finally { iso8601Lexer.close(); } }
return stringLiteral; case NULL://8 lexer.nextToken(); returnnull; case UNDEFINED://23 lexer.nextToken(); returnnull; case TRUE://6 lexer.nextToken(); return Boolean.TRUE; case FALSE://7 lexer.nextToken(); return Boolean.FALSE; case NEW://9 lexer.nextToken(JSONToken.IDENTIFIER);
if (lexer.token() != JSONToken.IDENTIFIER) { thrownewJSONException("syntax error"); } lexer.nextToken(JSONToken.LPAREN);