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

Function generate_wrappers

scripts/generate-lang-code.py:36–56  ·  view source on GitHub ↗

Create grammar_ .c wrapper files.

(langs)

Source from the content-addressed store, hash-verified

34
35
36def generate_wrappers(langs):
37 """Create grammar_<name>.c wrapper files."""
38 print("=== Grammar Wrapper Files ===")
39 created = 0
40 for lang in langs:
41 path = os.path.join(GRAMMAR_DIR, f"grammar_{lang['name']}.c")
42 if os.path.exists(path):
43 continue
44 lines = [
45 f"// Vendored tree-sitter grammar: {lang['name']}",
46 "// Each grammar compiled as separate unit (conflicting static symbols).",
47 f"#include \"vendored/grammars/{lang['name']}/parser.c\"",
48 ]
49 if lang["has_scanner"]:
50 lines.append(
51 f"#include \"vendored/grammars/{lang['name']}/scanner.c\""
52 )
53 with open(path, "w") as f:
54 f.write("\n".join(lines) + "\n")
55 created += 1
56 print(f" Created {created} wrapper files")
57
58
59def generate_enum(langs):

Callers 1

mainFunction · 0.85

Calls 2

openFunction · 0.50
writeMethod · 0.45

Tested by

no test coverage detected