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

Function c_command_at

internal/cbm/doclink_c.c:219–230  ·  view source on GitHub ↗

A command at p[i] (`\word` or `@word`, not inside a word or an address): * the word's length, else 0. */

Source from the content-addressed store, hash-verified

217/* A command at p[i] (`\word` or `@word`, not inside a word or an address):
218 * the word's length, else 0. */
219static size_t c_command_at(const char *p, size_t i, size_t n) {
220 if ((p[i] != '\\' && p[i] != '@') ||
221 (i > 0 &&
222 (c_ident_char(p[i - SKIP_ONE]) || p[i - SKIP_ONE] == '\\' || p[i - SKIP_ONE] == '@'))) {
223 return 0;
224 }
225 size_t k = i + SKIP_ONE;
226 while (k < n && isalpha((unsigned char)p[k])) {
227 k++;
228 }
229 return k - i - SKIP_ONE;
230}
231
232static bool c_word_is(const char *w, size_t n, const char *lit) {
233 return strlen(lit) == n && memcmp(w, lit, n) == 0;

Callers 3

c_lineFunction · 0.85
c_closes_blockFunction · 0.85
c_anchorsFunction · 0.85

Calls 1

c_ident_charFunction · 0.85

Tested by

no test coverage detected