| 469 | } |
| 470 | |
| 471 | void ReadQuotedString(TStringBuf* value) { |
| 472 | Buffer_.clear(); |
| 473 | while (true) { |
| 474 | if (TBaseStream::IsEmpty()) { |
| 475 | TBaseStream::Refresh(); |
| 476 | } |
| 477 | char ch = *TBaseStream::Begin(); |
| 478 | TBaseStream::Advance(1); |
| 479 | if (ch != '"') { |
| 480 | Buffer_.push_back(ch); |
| 481 | } else { |
| 482 | // We must count the number of '\' at the end of StringValue |
| 483 | // to check if it's not \" |
| 484 | int slashCount = 0; |
| 485 | int length = Buffer_.size(); |
| 486 | while (slashCount < length && Buffer_[length - 1 - slashCount] == '\\') { |
| 487 | ++slashCount; |
| 488 | } |
| 489 | if (slashCount % 2 == 0) { |
| 490 | break; |
| 491 | } else { |
| 492 | Buffer_.push_back(ch); |
| 493 | } |
| 494 | } |
| 495 | CheckMemoryLimit(); |
| 496 | } |
| 497 | |
| 498 | auto unquotedValue = UnescapeC(Buffer_.data(), Buffer_.size()); |
| 499 | Buffer_.clear(); |
| 500 | Buffer_.insert(Buffer_.end(), unquotedValue.data(), unquotedValue.data() + unquotedValue.size()); |
| 501 | CheckMemoryLimit(); |
| 502 | *value = TStringBuf(Buffer_.data(), Buffer_.size()); |
| 503 | } |
| 504 | |
| 505 | template <bool AllowFinish> |
| 506 | void ReadUnquotedString(TStringBuf* value) { |