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