Past a comment at src[i], or i when there is none. */
| 1673 | |
| 1674 | /* Past a comment at src[i], or i when there is none. */ |
| 1675 | static uint32_t cs_lex_comment(const cs_lex_t *lx, uint32_t i) { |
| 1676 | const char *src = lx->src; |
| 1677 | uint32_t n = lx->n; |
| 1678 | if (src[i] != '/' || i + SKIP_ONE >= n) { |
| 1679 | return i; |
| 1680 | } |
| 1681 | if (src[i + SKIP_ONE] == '/') { |
| 1682 | while (i < n && src[i] != '\n') { |
| 1683 | i++; |
| 1684 | } |
| 1685 | return i; |
| 1686 | } |
| 1687 | if (src[i + SKIP_ONE] == '*') { |
| 1688 | i += PAIR_LEN; |
| 1689 | while (i + SKIP_ONE < n && !(src[i] == '*' && src[i + SKIP_ONE] == '/')) { |
| 1690 | i++; |
| 1691 | } |
| 1692 | return i + PAIR_LEN <= n ? i + PAIR_LEN : n; |
| 1693 | } |
| 1694 | return i; |
| 1695 | } |
| 1696 | |
| 1697 | /* Scan code from src[i]. In a `hole` (the code of an interpolation) nothing |
| 1698 | * is reported and the scan returns just past the brace that closes it. */ |