MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / cs_lex_comment

Function cs_lex_comment

internal/cbm/doclink_cs.c:1675–1695  ·  view source on GitHub ↗

Past a comment at src[i], or i when there is none. */

Source from the content-addressed store, hash-verified

1673
1674/* Past a comment at src[i], or i when there is none. */
1675static 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. */

Callers 1

cs_lex_codeFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected