Skip to content

Commit 6d34ca1

Browse files
authored
Merge pull request #2948 from DeusData/feat/vendor-vbnet-grammar
chore(vendor): vendor the VB.NET tree-sitter grammar
2 parents 50079ed + a822260 commit 6d34ca1

28 files changed

Lines changed: 1977206 additions & 13 deletions

‎README.md‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
[![CI](https://img.shields.io/github/actions/workflow/status/DeusData/codebase-memory-mcp/release.yml?branch=main&label=main%20CI)](https://github.com/DeusData/codebase-memory-mcp/actions/workflows/release.yml)
66
[![Native and frontend tests](https://img.shields.io/badge/tests-native_%2B_frontend-blue)](#tests)
77
[![MCP tools](https://img.shields.io/badge/MCP_tools-17-blue)](#mcp-tools)
8-
[![Languages](https://img.shields.io/badge/languages-162-orange)](https://github.com/DeusData/codebase-memory-mcp)
8+
[![Languages](https://img.shields.io/badge/languages-163-orange)](https://github.com/DeusData/codebase-memory-mcp)
99
[![Hybrid LSP](https://img.shields.io/badge/Hybrid_LSP-type_resolution-blue)](#hybrid-lsp)
1010
[![Agents](https://img.shields.io/badge/agent_surfaces-46-purple)](https://github.com/DeusData/codebase-memory-mcp)
1111
[![Pure C](https://img.shields.io/badge/pure_C-no_language_runtime-blue)](https://github.com/DeusData/codebase-memory-mcp)
@@ -398,7 +398,7 @@ In this repository, test narrowing is wired to the Linux x86_64 test leg when `T
398398
- `SEMANTICALLY_RELATED` (vocabulary-mismatch, same-language, score ≥ 0.80)
399399

400400
### Indexing pipeline
401-
- **162 vendored tree-sitter grammars** compiled into the binary
401+
- **163 vendored tree-sitter grammars** compiled into the binary
402402
- **Generic package / module resolution**: bare specifiers like `@myorg/pkg`, `github.com/foo/bar`, `use my_crate::foo` resolved via manifest scanning (`package.json`, `go.mod`, `Cargo.toml`, `pyproject.toml`, `composer.json`, `pubspec.yaml`, `pom.xml`, `build.gradle`, `mix.exs`, `*.gemspec`)
403403
- **Infrastructure-as-code indexing**: Dockerfiles (`Dockerfile.*`, `*.Dockerfile`, `Containerfile`: bases, what the container runs, `ENV`), container images (`Image`: the normalised repository, tag and digest on the edges; a repository built from several Dockerfiles, one per component tag, gets an `Image` per component), docker compose services (`Resource`), Kubernetes manifests (`Resource`, with `group`, `version`, `kind`, `namespace`, `labels` as `k=v,k2=v2`), Kustomize overlays (`IMPORTS` to their entries and patch files, `OVERRIDE` from their patches), Helm charts (`Chart`, `DEPENDS_ON`), Terraform / OpenTofu (`.tf`, `.tofu`, `.tfvars`) as graph nodes. A Service walks to the code it runs: Service → workload → `Image` → Dockerfile → `main`
404404
- **[Hybrid LSP semantic type resolution](#hybrid-lsp)** for Python, TypeScript / JavaScript / JSX / TSX, PHP, C#, Go, C, C++, Java, Kotlin, Rust, and Perl; a lightweight C implementation of language type-resolution algorithms, structurally inspired by and compatible with major language servers including tsserver / typescript-go, pyright, gopls, Roslyn, Eclipse JDT, and rust-analyzer (parameter binding, return-type inference, generic substitution, JSX component dispatch, JSDoc inference for plain JS files, namespace + trait + late-static-binding resolution for PHP, file-scoped namespaces + records + LINQ method syntax for C#, class-hierarchy + overload + lambda resolution for Java, extension-function + scope-function resolution for Kotlin, trait-method + UFCS resolution for Rust)
@@ -1124,14 +1124,14 @@ codebase-memory-mcp ships a **lightweight C implementation of language type-reso
11241124

11251125
**Two-layer architecture:**
11261126

1127-
1. **Tree-sitter pass**: fast, syntactic, runs for every one of the 162 languages. Extracts definitions, calls, imports.
1127+
1. **Tree-sitter pass**: fast, syntactic, runs for every one of the 163 languages. Extracts definitions, calls, imports.
11281128
2. **Hybrid LSP pass**: type-aware, runs above the tree-sitter pass per-language. Refines call edges using the import graph plus a per-file or pre-built cross-file definition registry. Languages without a Hybrid LSP pass yet fall back to textual resolution, with coverage varying by language and construct.
11291129

11301130
The result is a knowledge graph accurate enough to drive `trace_path` across packages, inheritance hierarchies, and stdlib calls; without paying for a language server process per project.
11311131

11321132
## Language Support
11331133

1134-
162 languages, counted by the vendored grammar directories in [the parser manifest](internal/cbm/vendored/grammars/MANIFEST.md). Benchmarked against 64 real open-source repositories (78 to 49K nodes):
1134+
163 languages, counted by the vendored grammar directories in [the parser manifest](internal/cbm/vendored/grammars/MANIFEST.md). Benchmarked against 64 real open-source repositories (78 to 49K nodes):
11351135

11361136
| Tier | Score | Languages |
11371137
|------|-------|-----------|
@@ -1158,7 +1158,7 @@ src/
11581158
ui/ Local HTTP server + embedded CBM Lens frontend
11591159
foundation/ Platform abstractions (threads, filesystem, logging, memory)
11601160
graph-ui/ CodeAtlasWeb: React, Monaco, and Three.js browser frontend
1161-
internal/cbm/ Vendored tree-sitter grammars (162 languages) + AST extraction engine
1161+
internal/cbm/ Vendored tree-sitter grammars (163 languages) + AST extraction engine
11621162
```
11631163

11641164
## Security

‎THIRD_PARTY.md‎

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ The core runtime headers in `internal/cbm/vendored/common/tree_sitter/`
3737

3838
## Tree-sitter Grammars
3939

40-
160 pre-generated parsers are vendored in `internal/cbm/vendored/grammars/<lang>/`
40+
163 pre-generated parsers are vendored in `internal/cbm/vendored/grammars/<lang>/`
4141
(generated `parser.c` plus `scanner.c` where applicable, compiled statically).
4242
Each grammar is the work of its upstream authors and each grammar directory
4343
contains the upstream `LICENSE` file.
@@ -60,8 +60,8 @@ License summary:
6060
smart-coin language, written for this project because no usable public
6161
grammar exists; its source and corpus tests live in
6262
`tools/tree-sitter-chialisp/`.
63-
- Ten further grammars (`arkts`, `assembly`, `cfml`,
64-
`cfscript`, `dotenv`, `javascript`, `pascal`, `pine`, `qml`, `tsx`) are
63+
- Eleven further grammars (`arkts`, `assembly`, `cfml`,
64+
`cfscript`, `dotenv`, `javascript`, `pascal`, `pine`, `qml`, `tsx`, `vbnet`) are
6565
self-maintained forks that retain their original upstream authors' licenses —
6666
see the manifest for per-grammar provenance. `arkts` is a first-party derivative of
6767
[tree-sitter/tree-sitter-typescript](https://github.com/tree-sitter/tree-sitter-typescript)
@@ -79,7 +79,29 @@ License summary:
7979
([Isopod/tree-sitter-pascal](https://github.com/Isopod/tree-sitter-pascal),
8080
MIT, (c) 2018 Benjamin Gray) is the upstream grammar with one (c) 2026
8181
DeusData patch that accepts non-ASCII letters in identifiers; its grammar
82-
source lives in `tools/tree-sitter-pascal/`.
82+
source lives in `tools/tree-sitter-pascal/`. `vbnet` is described in its own
83+
section below.
84+
85+
### tree-sitter-vbnet (with CodeGraph's real-world VB.NET patch)
86+
87+
- **Project:** [govindbanura/tree-sitter-vbnet](https://github.com/govindbanura/tree-sitter-vbnet)
88+
- **License:** MIT
89+
- **Copyright:** (c) 2025 Govind Banura
90+
- **Patch:** `docs/grammars/tree-sitter-vbnet.patch` from
91+
[colbymchenry/codegraph](https://github.com/colbymchenry/codegraph)
92+
(CodeGraph), MIT, (c) 2026 Colby Mchenry. The patch rewrites much of the
93+
grammar and adds the external scanner (`scanner.c`), so CodeGraph's license
94+
text ships next to the code as `LICENSE-codegraph`.
95+
- **Vendored at:** `internal/cbm/vendored/grammars/vbnet/`
96+
- **Pinned commits:** grammar `538b7087bf80` (v0.1-beta); patch `fe7542b6f6a4`
97+
- **Notes:** Visual Basic .NET grammar, maintained here as a self-maintained
98+
fork: the grammar source, the verbatim patch and the regeneration recipe live
99+
in `tools/tree-sitter-vbnet/`, and the parser is generated in this repository
100+
with tree-sitter-cli 0.25.10 (upstream checks in no generated sources). One
101+
local patch of ours, (c) 2026 DeusData, makes the scanner stop at text that
102+
cannot be XML (`tools/tree-sitter-vbnet/patches/xml-literal-tag-syntax.patch`).
103+
The grammar is vendored ahead of VB.NET extraction (#1179); provenance hashes
104+
are in `internal/cbm/vendored/grammars/MANIFEST.md`.
83105

84106
### tree-sitter-plsql
85107

‎internal/cbm/grammar_vbnet.c‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
// Vendored tree-sitter grammar: vbnet
2+
// Each grammar compiled as separate unit (conflicting static symbols).
3+
#include "vendored/grammars/vbnet/parser.c"
4+
#include "vendored/grammars/vbnet/scanner.c"

0 commit comments

Comments
 (0)