| 725 | } |
| 726 | |
| 727 | bool Reader::readArray(Token &token) { |
| 728 | Value init(arrayValue); |
| 729 | currentValue().swapPayload(init); |
| 730 | currentValue().setOffsetStart(token.start_ - begin_); |
| 731 | skipSpaces(); |
| 732 | if (current_ != end_ && *current_ == ']') // empty array |
| 733 | { |
| 734 | Token endArray; |
| 735 | readToken(endArray); |
| 736 | return true; |
| 737 | } |
| 738 | int index = 0; |
| 739 | for (;;) { |
| 740 | Value &value = currentValue()[index++]; |
| 741 | nodes_.push(&value); |
| 742 | bool ok = readValue(); |
| 743 | nodes_.pop(); |
| 744 | if (!ok) // error already set |
| 745 | return recoverFromError(tokenArrayEnd); |
| 746 | |
| 747 | Token currentToken; |
| 748 | // Accept Comment after last item in the array. |
| 749 | ok = readToken(currentToken); |
| 750 | while (currentToken.type_ == tokenComment && ok) { |
| 751 | ok = readToken(currentToken); |
| 752 | } |
| 753 | bool badTokenType = (currentToken.type_ != tokenArraySeparator && |
| 754 | currentToken.type_ != tokenArrayEnd); |
| 755 | if (!ok || badTokenType) { |
| 756 | return addErrorAndRecover("Missing ',' or ']' in array declaration", |
| 757 | currentToken, tokenArrayEnd); |
| 758 | } |
| 759 | if (currentToken.type_ == tokenArrayEnd) |
| 760 | break; |
| 761 | } |
| 762 | return true; |
| 763 | } |
| 764 | |
| 765 | bool Reader::decodeNumber(Token &token) { |
| 766 | Value decoded; |
nothing calls this directly
no test coverage detected