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

Function lisp_push_clause_modules

internal/cbm/extract_imports.c:2404–2420  ·  view source on GitHub ↗

Clojure `(ns app.core (:require [app.util :as u]) (:use app.io))` and Common * Lisp `(defpackage :main (:use :cl :util))` carry their dependency list inside * nested keyword clauses (`:require`/`:use`/`:import`). Walk such a clause and * push each referenced module/package as an import. `clause` is the * `(:require ...)` / `(:use ...)` list. */

Source from the content-addressed store, hash-verified

2402 * push each referenced module/package as an import. `clause` is the
2403 * `(:require ...)` / `(:use ...)` list. */
2404static void lisp_push_clause_modules(CBMExtractCtx *ctx, TSNode clause) {
2405 uint32_t cc = ts_node_named_child_count(clause);
2406 for (uint32_t j = 1; j < cc; j++) { /* skip the leading keyword head */
2407 TSNode item = ts_node_named_child(clause, j);
2408 const char *ik = ts_node_type(item);
2409 /* `[app.util :as u]` — the module is the vector's first symbol. */
2410 if (strcmp(ik, "vec_lit") == 0 || strcmp(ik, "list_lit") == 0 || strcmp(ik, "list") == 0) {
2411 uint32_t vc = ts_node_named_child_count(item);
2412 if (vc > 0) {
2413 lisp_push_module(ctx, ts_node_named_child(item, 0));
2414 }
2415 } else {
2416 /* bare symbol/keyword: `:util`, `app.io`. */
2417 lisp_push_module(ctx, item);
2418 }
2419 }
2420}
2421
2422/* The s-expression head symbol text, or NULL if the list has no symbol head. */
2423static char *lisp_head_text(CBMExtractCtx *ctx, TSNode list, TSNode *out_head) {

Callers 1

lisp_process_listFunction · 0.85

Calls 1

lisp_push_moduleFunction · 0.85

Tested by

no test coverage detected