| 641 | } |
| 642 | |
| 643 | bool Reader::readArray(Token &tokenStart) { |
| 644 | currentValue() = Value(arrayValue); |
| 645 | currentValue().setOffsetStart(tokenStart.start_ - begin_); |
| 646 | skipSpaces(); |
| 647 | if (*current_ == ']') // empty array |
| 648 | { |
| 649 | Token endArray; |
| 650 | readToken(endArray); |
| 651 | return true; |
| 652 | } |
| 653 | int index = 0; |
| 654 | for (;;) { |
| 655 | Value &value = currentValue()[index++]; |
| 656 | nodes_.push(&value); |
| 657 | bool ok = readValue(); |
| 658 | nodes_.pop(); |
| 659 | if (!ok) // error already set |
| 660 | return recoverFromError(tokenArrayEnd); |
| 661 | |
| 662 | Token token; |
| 663 | // Accept Comment after last item in the array. |
| 664 | ok = readToken(token); |
| 665 | while (token.type_ == tokenComment && ok) { |
| 666 | ok = readToken(token); |
| 667 | } |
| 668 | bool badTokenType = |
| 669 | (token.type_ != tokenArraySeparator && token.type_ != tokenArrayEnd); |
| 670 | if (!ok || badTokenType) { |
| 671 | return addErrorAndRecover( |
| 672 | "Missing ',' or ']' in array declaration", token, tokenArrayEnd); |
| 673 | } |
| 674 | if (token.type_ == tokenArrayEnd) |
| 675 | break; |
| 676 | } |
| 677 | return true; |
| 678 | } |
| 679 | |
| 680 | bool Reader::decodeNumber(Token &token) { |
| 681 | Value decoded; |
nothing calls this directly
no test coverage detected