| 378 | } |
| 379 | |
| 380 | bool Reader::readValue() { |
| 381 | // readValue() may call itself only if it calls readObject() or ReadArray(). |
| 382 | // These methods execute nodes_.push() just before and nodes_.pop)() just after calling readValue(). |
| 383 | // parse() executes one nodes_.push(), so > instead of >=. |
| 384 | if (nodes_.size() > stackLimit_g) throwRuntimeError("Exceeded stackLimit in readValue()."); |
| 385 | |
| 386 | Token token; |
| 387 | skipCommentTokens(token); |
| 388 | bool successful = true; |
| 389 | |
| 390 | if (collectComments_ && !commentsBefore_.empty()) { |
| 391 | currentValue().setComment(commentsBefore_, commentBefore); |
| 392 | commentsBefore_.clear(); |
| 393 | } |
| 394 | |
| 395 | switch (token.type_) { |
| 396 | case tokenObjectBegin: |
| 397 | successful = readObject(token); |
| 398 | currentValue().setOffsetLimit(current_ - begin_); |
| 399 | break; |
| 400 | case tokenArrayBegin: |
| 401 | successful = readArray(token); |
| 402 | currentValue().setOffsetLimit(current_ - begin_); |
| 403 | break; |
| 404 | case tokenNumber: |
| 405 | successful = decodeNumber(token); |
| 406 | break; |
| 407 | case tokenString: |
| 408 | successful = decodeString(token); |
| 409 | break; |
| 410 | case tokenTrue: |
| 411 | { |
| 412 | Value v(true); |
| 413 | currentValue().swapPayload(v); |
| 414 | currentValue().setOffsetStart(token.start_ - begin_); |
| 415 | currentValue().setOffsetLimit(token.end_ - begin_); |
| 416 | } |
| 417 | break; |
| 418 | case tokenFalse: |
| 419 | { |
| 420 | Value v(false); |
| 421 | currentValue().swapPayload(v); |
| 422 | currentValue().setOffsetStart(token.start_ - begin_); |
| 423 | currentValue().setOffsetLimit(token.end_ - begin_); |
| 424 | } |
| 425 | break; |
| 426 | case tokenNull: |
| 427 | { |
| 428 | Value v; |
| 429 | currentValue().swapPayload(v); |
| 430 | currentValue().setOffsetStart(token.start_ - begin_); |
| 431 | currentValue().setOffsetLimit(token.end_ - begin_); |
| 432 | } |
| 433 | break; |
| 434 | case tokenArraySeparator: |
| 435 | case tokenObjectEnd: |
| 436 | case tokenArrayEnd: |
| 437 | if (features_.allowDroppedNullPlaceholders_) { |
nothing calls this directly
no test coverage detected