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

Function rs_inline_backticks

internal/cbm/doclink_rs.c:1787–1811  ·  view source on GitHub ↗

Past the code span that opens at the backtick s[i], or past its run alone * when no later run has the opener's length. The opener is what is left of * its run from s[i] on (a backslash before the run takes its first backtick). */

Source from the content-addressed store, hash-verified

1785 * when no later run has the opener's length. The opener is what is left of
1786 * its run from s[i] on (a backslash before the run takes its first backtick). */
1787static uint32_t rs_inline_backticks(rs_inline_t *in, uint32_t i) {
1788 while (in->run_cursor < in->nruns &&
1789 in->runs[in->run_cursor].pos + in->runs[in->run_cursor].len <= i) {
1790 in->run_cursor++;
1791 }
1792 if (in->run_cursor >= in->nruns) {
1793 return i + SKIP_ONE;
1794 }
1795 uint32_t run_end = in->runs[in->run_cursor].pos + in->runs[in->run_cursor].len;
1796 rs_run_t want = {.pos = run_end, .len = run_end - i};
1797 int lo = 0;
1798 int hi = in->nruns;
1799 while (lo < hi) {
1800 int mid = lo + ((hi - lo) / PAIR_LEN);
1801 if (rs_run_len_cmp(&in->by_len[mid], &want) < 0) {
1802 lo = mid + SKIP_ONE;
1803 } else {
1804 hi = mid;
1805 }
1806 }
1807 if (lo < in->nruns && in->by_len[lo].len == want.len) {
1808 return in->by_len[lo].pos + want.len;
1809 }
1810 return run_end;
1811}
1812
1813/* Index just past the first `mark` at or after s[from], or 0. */
1814static uint32_t rs_find_after(const rs_inline_t *in, uint32_t from, const char *mark) {

Callers 1

rs_inline_scanFunction · 0.85

Calls 1

rs_run_len_cmpFunction · 0.85

Tested by

no test coverage detected