MCPcopy Create free account
hub / github.com/Kitware/CMake / readArray

Method readArray

Utilities/cmjsoncpp/src/lib_json/json_reader.cpp:490–523  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

488}
489
490bool Reader::readArray(Token& token) {
491 Value init(arrayValue);
492 currentValue().swapPayload(init);
493 currentValue().setOffsetStart(token.start_ - begin_);
494 skipSpaces();
495 if (current_ != end_ && *current_ == ']') // empty array
496 {
497 Token endArray;
498 readToken(endArray);
499 return true;
500 }
501 int index = 0;
502 for (;;) {
503 Value& value = currentValue()[index++];
504 nodes_.push(&value);
505 bool ok = readValue();
506 nodes_.pop();
507 if (!ok) // error already set
508 return recoverFromError(tokenArrayEnd);
509
510 Token currentToken;
511 // Accept Comment after last item in the array.
512 ok = readTokenSkippingComments(currentToken);
513 bool badTokenType = (currentToken.type_ != tokenArraySeparator &&
514 currentToken.type_ != tokenArrayEnd);
515 if (!ok || badTokenType) {
516 return addErrorAndRecover("Missing ',' or ']' in array declaration",
517 currentToken, tokenArrayEnd);
518 }
519 if (currentToken.type_ == tokenArrayEnd)
520 break;
521 }
522 return true;
523}
524
525bool Reader::decodeNumber(Token& token) {
526 Value decoded;

Callers

nothing calls this directly

Calls 2

swapPayloadMethod · 0.80
setOffsetStartMethod · 0.80

Tested by

no test coverage detected