MCPcopy Create free account
hub / github.com/WolfireGames/overgrowth / readArray

Method readArray

Source/JSON/jsoncpp.cpp:648–683  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 3

swapPayloadMethod · 0.45
pushMethod · 0.45
popMethod · 0.45

Tested by

no test coverage detected