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

Function op_prev_code

src/pipeline/pass_operator.c:382–399  ·  view source on GitHub ↗

The code character before `at`, past blanks and `//` comments: gofmt * puts a chain's '.' at the end of an earlier line, and comment lines may * sit between. NULL at the start of the text. */

Source from the content-addressed store, hash-verified

380 * puts a chain's '.' at the end of an earlier line, and comment lines may
381 * sit between. NULL at the start of the text. */
382static const char *op_prev_code(const char *text, const char *at) {
383 const char *le = at;
384 for (;;) {
385 const char *ls = op_line_start(text, le);
386 const char *end = op_comment_start(ls, le);
387 while (end > ls &&
388 (end[-SKIP_ONE] == ' ' || end[-SKIP_ONE] == '\t' || end[-SKIP_ONE] == '\r')) {
389 end--;
390 }
391 if (end > ls) {
392 return end - SKIP_ONE;
393 }
394 if (ls == text) {
395 return NULL;
396 }
397 le = ls - SKIP_ONE; /* the previous line, without its '\n' */
398 }
399}
400
401/* The end of the argument list opened at `open` ('('), balanced; parentheses
402 * in `//` comments and literals do not count. */

Callers 1

op_controller_callsFunction · 0.85

Calls 2

op_line_startFunction · 0.85
op_comment_startFunction · 0.85

Tested by

no test coverage detected