| 588 | } |
| 589 | |
| 590 | static JSONCPP_STRING normalizeEOL(Reader::Location begin, Reader::Location end) { |
| 591 | JSONCPP_STRING normalized; |
| 592 | normalized.reserve(static_cast<size_t>(end - begin)); |
| 593 | Reader::Location current = begin; |
| 594 | while (current != end) { |
| 595 | char c = *current++; |
| 596 | if (c == '\r') { |
| 597 | if (current != end && *current == '\n') |
| 598 | // convert dos EOL |
| 599 | ++current; |
| 600 | // convert Mac EOL |
| 601 | normalized += '\n'; |
| 602 | } else { |
| 603 | normalized += c; |
| 604 | } |
| 605 | } |
| 606 | return normalized; |
| 607 | } |
| 608 | |
| 609 | void |
| 610 | Reader::addComment(Location begin, Location end, CommentPlacement placement) { |