MCPcopy Create free account
hub / github.com/Illumina/paragraph / readArray

Method readArray

external/jsoncpp/jsoncpp.cpp:732–768  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 2

swapPayloadMethod · 0.80
setOffsetStartMethod · 0.80

Tested by

no test coverage detected