| 1583 | #define ENDSWITH(c, e) ((c) == (e) || ((c) == 0 && endch == (e))) |
| 1584 | |
| 1585 | char_t* strconv_comment(char_t* s, char_t endch) |
| 1586 | { |
| 1587 | gap g; |
| 1588 | |
| 1589 | while (true) |
| 1590 | { |
| 1591 | while (!IS_CHARTYPE(*s, ct_parse_comment)) ++s; |
| 1592 | |
| 1593 | if (*s == '\r') // Either a single 0x0d or 0x0d 0x0a pair |
| 1594 | { |
| 1595 | *s++ = '\n'; // replace first one with 0x0a |
| 1596 | |
| 1597 | if (*s == '\n') g.push(s, 1); |
| 1598 | } |
| 1599 | else if (s[0] == '-' && s[1] == '-' && ENDSWITH(s[2], '>')) // comment ends here |
| 1600 | { |
| 1601 | *g.flush(s) = 0; |
| 1602 | |
| 1603 | return s + (s[2] == '>' ? 3 : 2); |
| 1604 | } |
| 1605 | else if (*s == 0) |
| 1606 | { |
| 1607 | return 0; |
| 1608 | } |
| 1609 | else ++s; |
| 1610 | } |
| 1611 | } |
| 1612 | |
| 1613 | char_t* strconv_cdata(char_t* s, char_t endch) |
| 1614 | { |
no test coverage detected