| 403 | } |
| 404 | |
| 405 | bool Reader::readValue() |
| 406 | { |
| 407 | // readValue() may call itself only if it calls readObject() or ReadArray(). |
| 408 | // These methods execute nodes_.push() just before and nodes_.pop)() just |
| 409 | // after calling readValue(). parse() executes one nodes_.push(), so > instead |
| 410 | // of >=. |
| 411 | if (nodes_.size() > stackLimit_g) |
| 412 | throwRuntimeError("Exceeded stackLimit in readValue()."); |
| 413 | |
| 414 | Token token; |
| 415 | skipCommentTokens(token); |
| 416 | bool successful = true; |
| 417 | |
| 418 | if (collectComments_ && !commentsBefore_.empty()) |
| 419 | { |
| 420 | currentValue().setComment(commentsBefore_, commentBefore); |
| 421 | commentsBefore_.clear(); |
| 422 | } |
| 423 | |
| 424 | switch (token.type_) |
| 425 | { |
| 426 | case tokenObjectBegin: |
| 427 | successful = readObject(token); |
| 428 | currentValue().setOffsetLimit(current_ - begin_); |
| 429 | break; |
| 430 | case tokenArrayBegin: |
| 431 | successful = readArray(token); |
| 432 | currentValue().setOffsetLimit(current_ - begin_); |
| 433 | break; |
| 434 | case tokenNumber: |
| 435 | successful = decodeNumber(token); |
| 436 | break; |
| 437 | case tokenString: |
| 438 | successful = decodeString(token); |
| 439 | break; |
| 440 | case tokenTrue: |
| 441 | { |
| 442 | Value v(true); |
| 443 | currentValue().swapPayload(v); |
| 444 | currentValue().setOffsetStart(token.start_ - begin_); |
| 445 | currentValue().setOffsetLimit(token.end_ - begin_); |
| 446 | } |
| 447 | break; |
| 448 | case tokenFalse: |
| 449 | { |
| 450 | Value v(false); |
| 451 | currentValue().swapPayload(v); |
| 452 | currentValue().setOffsetStart(token.start_ - begin_); |
| 453 | currentValue().setOffsetLimit(token.end_ - begin_); |
| 454 | } |
| 455 | break; |
| 456 | case tokenNull: |
| 457 | { |
| 458 | Value v; |
| 459 | currentValue().swapPayload(v); |
| 460 | currentValue().setOffsetStart(token.start_ - begin_); |
| 461 | currentValue().setOffsetLimit(token.end_ - begin_); |
| 462 | } |
nothing calls this directly
no test coverage detected