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:1695–1711  ·  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

1693 * push each referenced module/package as an import. `clause` is the
1694 * `(:require ...)` / `(:use ...)` list. */
1695static void lisp_push_clause_modules(CBMExtractCtx *ctx, TSNode clause) {
1696 uint32_t cc = ts_node_named_child_count(clause);
1697 for (uint32_t j = 1; j < cc; j++) { /* skip the leading keyword head */
1698 TSNode item = ts_node_named_child(clause, j);
1699 const char *ik = ts_node_type(item);
1700 /* `[app.util :as u]` — the module is the vector's first symbol. */
1701 if (strcmp(ik, "vec_lit") == 0 || strcmp(ik, "list_lit") == 0 || strcmp(ik, "list") == 0) {
1702 uint32_t vc = ts_node_named_child_count(item);
1703 if (vc > 0) {
1704 lisp_push_module(ctx, ts_node_named_child(item, 0));
1705 }
1706 } else {
1707 /* bare symbol/keyword: `:util`, `app.io`. */
1708 lisp_push_module(ctx, item);
1709 }
1710 }
1711}
1712
1713/* The s-expression head symbol text, or NULL if the list has no symbol head. */
1714static 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