(boolean firstElement)
| 708 | } |
| 709 | |
| 710 | @SuppressWarnings("fallthrough") |
| 711 | private JsonToken nextInObject(boolean firstElement) throws IOException { |
| 712 | /* |
| 713 | * Read delimiters. Either a comma/semicolon separating this and the |
| 714 | * previous name-value pair, or a close brace to denote the end of the |
| 715 | * object. |
| 716 | */ |
| 717 | if (firstElement) { |
| 718 | /* Peek to see if this is the empty object. */ |
| 719 | switch (nextNonWhitespace()) { |
| 720 | case '}': |
| 721 | pop(); |
| 722 | hasToken = true; |
| 723 | return token = JsonToken.END_OBJECT; |
| 724 | default: |
| 725 | pos--; |
| 726 | } |
| 727 | } else { |
| 728 | switch (nextNonWhitespace()) { |
| 729 | case '}': |
| 730 | pop(); |
| 731 | hasToken = true; |
| 732 | return token = JsonToken.END_OBJECT; |
| 733 | case ';': |
| 734 | case ',': |
| 735 | break; |
| 736 | default: |
| 737 | throw syntaxError("Unterminated object"); |
| 738 | } |
| 739 | } |
| 740 | |
| 741 | /* Read the name. */ |
| 742 | int quote = nextNonWhitespace(); |
| 743 | switch (quote) { |
| 744 | case '\'': |
| 745 | checkLenient(); // fall-through |
| 746 | case '"': |
| 747 | name = nextString((char) quote); |
| 748 | break; |
| 749 | default: |
| 750 | checkLenient(); |
| 751 | pos--; |
| 752 | name = nextLiteral(); |
| 753 | if (name.length() == 0) { |
| 754 | throw syntaxError("Expected name"); |
| 755 | } |
| 756 | } |
| 757 | |
| 758 | replaceTop(JsonScope.DANGLING_NAME); |
| 759 | hasToken = true; |
| 760 | return token = JsonToken.NAME; |
| 761 | } |
| 762 | |
| 763 | private JsonToken objectValue() throws IOException { |
| 764 | /* |
no test coverage detected