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

Function cs_lex_raw

internal/cbm/doclink_cs.c:1520–1542  ·  view source on GitHub ↗

"""...""" (`quotes` >= 3 of them): ends with a run of at least as many. * With `dollars`, a run of that many `{` opens a hole of code. */

Source from the content-addressed store, hash-verified

1518/* """...""" (`quotes` >= 3 of them): ends with a run of at least as many.
1519 * With `dollars`, a run of that many `{` opens a hole of code. */
1520static uint32_t cs_lex_raw(cs_lex_t *lx, uint32_t i, uint32_t quotes, uint32_t dollars) {
1521 uint32_t j = i + quotes;
1522 while (j < lx->n) {
1523 char c = lx->src[j];
1524 if (c == '"') {
1525 uint32_t run = cs_lex_run(lx, j, '"');
1526 if (run >= quotes) {
1527 return j + run;
1528 }
1529 j += run;
1530 } else if (dollars > 0 && c == '{') {
1531 uint32_t run = cs_lex_run(lx, j, '{');
1532 j += run;
1533 if (run >= dollars) {
1534 j = cs_lex_hole(lx, j);
1535 j += cs_lex_run(lx, j, '}'); /* the rest of the closing run */
1536 }
1537 } else {
1538 j++;
1539 }
1540 }
1541 return lx->n;
1542}
1543
1544/* $"..." / $@"..." : text with {holes} of code; {{ and }} are literal braces.
1545 * `i` is at the opening quote. */

Callers 1

cs_lex_literalFunction · 0.85

Calls 2

cs_lex_runFunction · 0.85
cs_lex_holeFunction · 0.85

Tested by

no test coverage detected