Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
4dfe2e1
feat(visualbasic): vendor patched tree-sitter-vb-dotnet grammar
ankitsusheel Jul 19, 2026
b22f88a
feat(visualbasic): register VB.NET and wire structural extraction
ankitsusheel Jul 19, 2026
dae0f7e
test(visualbasic): extraction/regression/label/language coverage + RE…
ankitsusheel Jul 19, 2026
0282b46
fix(ci): resolve lint and license-gate failures
ankitsusheel Jul 19, 2026
6afccc3
style(ci): clang-format vb_branch_types initializer
ankitsusheel Jul 19, 2026
f52c5fa
fix(visualbasic): rebase onto main, close vendoring/registry gaps fou…
ankitsusheel Aug 14, 2026
3cc3a3f
Merge origin/main into feat/vbnet-structural-extraction
DeusData Nov 11, 2026
fde8a65
feat(visualbasic): register VB.NET on the vendored vbnet grammar
DeusData Nov 11, 2026
f07a66d
feat(visualbasic): port the extractor to the vbnet node kinds
DeusData Nov 11, 2026
1e589d3
feat(visualbasic): resolve VB.NET names case-insensitively
DeusData Nov 11, 2026
caed7e4
fix(visualbasic): never bind a VB.NET call to an enum member
DeusData Nov 11, 2026
6dd5db5
Merge origin/main into feat/vbnet-structural-extraction
DeusData Nov 11, 2026
d7986c0
Merge origin/main into feat/vbnet-structural-extraction
DeusData Nov 12, 2026
91f457f
fix(visualbasic): clear the GCC, cppcheck and vendored-integrity reds
DeusData Nov 12, 2026
2f37f6f
Merge origin/main into feat/vbnet-structural-extraction
DeusData Nov 13, 2026
c6c6a2a
test(visualbasic): pin the case-insensitive retry on references
DeusData Nov 13, 2026
2fb3ea1
Merge origin/main into feat/vbnet-structural-extraction
DeusData Nov 14, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1139,7 +1139,7 @@ The result is a knowledge graph accurate enough to drive `trace_path` across pac
| **Good** (75-89%) | | Python, TypeScript, TSX, Go, Rust, Java, R, Dart, JavaScript, Erlang, Elixir, Scala, Ruby, PHP, C#, SQL |
| **Functional** (< 75%) | | OCaml, Haskell |

Also supported (not yet benchmarked): Ada, Agda, Apex, ArkTS, Assembly (NASM), Astro, AWK, Beancount, BibTeX, Bicep, Bitbake, Blade, Cairo, Cap'n Proto, CFML, CFScript, Chialisp, Clojure, CMake, COBOL, Common Lisp, Crystal, CSV, CUDA, D, Devicetree, Diff, .env, Elm, Emacs Lisp, F#, Fennel, Fish, FORM, Fortran, FunC, GDScript, .gitattributes, .gitignore, Gleam, GLSL, GN, Go module, Go template, GraphQL, Hare, HLSL, Hyprlang, INI, ISPC, Janet, Jinja2, JSDoc, JSON, JSON5, Jsonnet, Julia, Just, Kconfig, KDL, Lean 4, Linker Script, Liquid, LLVM IR, Luau, Magma, Makefile, Markdown, MATLAB, Mermaid, Meson, Mojo, Move, Nickel, Nix, ObjectScript (UDL and routines), Odin, Pascal, Pine Script, Pkl, PL/SQL, PO (gettext), Pony, PowerShell, Prisma, .properties, Protobuf, Puppet, PureScript, QML, Racket, Regex, requirements.txt, ReScript, RON, reStructuredText, Scheme, Slang, Smali, Smithy, Solidity, SOQL, SOSL, Squirrel, SSH config, Starlark, Svelte, Sway, SystemVerilog, TableGen, Tcl, Teal, Templ, Thrift, TLA+, Typst, Verilog, VHDL, Vim script, Vue, WGSL, WIT, Wolfram, XML, Zsh.
Also supported (not yet benchmarked): Ada, Agda, Apex, ArkTS, Assembly (NASM), Astro, AWK, Beancount, BibTeX, Bicep, Bitbake, Blade, Cairo, Cap'n Proto, CFML, CFScript, Chialisp, Clojure, CMake, COBOL, Common Lisp, Crystal, CSV, CUDA, D, Devicetree, Diff, .env, Elm, Emacs Lisp, F#, Fennel, Fish, FORM, Fortran, FunC, GDScript, .gitattributes, .gitignore, Gleam, GLSL, GN, Go module, Go template, GraphQL, Hare, HLSL, Hyprlang, INI, ISPC, Janet, Jinja2, JSDoc, JSON, JSON5, Jsonnet, Julia, Just, Kconfig, KDL, Lean 4, Linker Script, Liquid, LLVM IR, Luau, Magma, Makefile, Markdown, MATLAB, Mermaid, Meson, Mojo, Move, Nickel, Nix, ObjectScript (UDL and routines), Odin, Pascal, Pine Script, Pkl, PL/SQL, PO (gettext), Pony, PowerShell, Prisma, .properties, Protobuf, Puppet, PureScript, QML, Racket, Regex, requirements.txt, ReScript, RON, reStructuredText, Scheme, Slang, Smali, Smithy, Solidity, SOQL, SOSL, Squirrel, SSH config, Starlark, Svelte, Sway, SystemVerilog, TableGen, Tcl, Teal, Templ, Thrift, TLA+, Typst, VB.NET, Verilog, VHDL, Vim script, Vue, WGSL, WIT, Wolfram, XML, Zsh.

## Architecture

Expand Down
19 changes: 10 additions & 9 deletions internal/cbm/cbm.h
Original file line number Diff line number Diff line change
Expand Up @@ -206,15 +206,16 @@ typedef enum {
CBM_LANG_OBJECTSCRIPT_UDL, // InterSystems ObjectScript UDL (.cls class files)
CBM_LANG_OBJECTSCRIPT_ROUTINE, // InterSystems ObjectScript routine (.mac/.int/.rtn/.inc)
CBM_LANG_OBJECTSCRIPT_EXPORT, // InterSystems Studio Export XML (<Export generator="Cache">)
CBM_LANG_ARKTS, // ArkTS (HarmonyOS/OpenHarmony .ets — TypeScript superset + ArkUI)
CBM_LANG_PLSQL, // Oracle PL/SQL
CBM_LANG_CHIALISP, // Chialisp (.clsp/.clib/.clinc — Chia smart-coin s-expression language)
CBM_LANG_PDF, // PDF documents: the text layer, read without a grammar (doc_pdf.c)
CBM_LANG_ASCIIDOC, // AsciiDoc documents, read without a grammar (doc_adoc.c)
CBM_LANG_OPENAPI, // openapi.json / swagger.json: the JSON grammar, no node per key; their
// operations are Routes (openapi.c)
CBM_LANG_DIAGRAM, // diagram files (PlantUML, DOT, D2, draw.io, Excalidraw), read
// without a grammar (diagram.c)
CBM_LANG_ARKTS, // ArkTS (HarmonyOS/OpenHarmony .ets — TypeScript superset + ArkUI)
CBM_LANG_PLSQL, // Oracle PL/SQL
CBM_LANG_CHIALISP, // Chialisp (.clsp/.clib/.clinc — Chia smart-coin s-expression language)
CBM_LANG_PDF, // PDF documents: the text layer, read without a grammar (doc_pdf.c)
CBM_LANG_ASCIIDOC, // AsciiDoc documents, read without a grammar (doc_adoc.c)
CBM_LANG_OPENAPI, // openapi.json / swagger.json: the JSON grammar, no node per key; their
// operations are Routes (openapi.c)
CBM_LANG_DIAGRAM, // diagram files (PlantUML, DOT, D2, draw.io, Excalidraw), read
// without a grammar (diagram.c)
CBM_LANG_VISUALBASIC, // VB.NET (.vb — WinForms, class libraries)
CBM_LANG_COUNT
} CBMLanguage;

Expand Down
129 changes: 129 additions & 0 deletions internal/cbm/extract_calls.c
Original file line number Diff line number Diff line change
Expand Up @@ -1603,6 +1603,127 @@ static char *extract_puppet_callee(CBMArena *a, TSNode node, const char *source,
return NULL;
}

/* VB.NET `New A.B.C(...)`: the grammar parses `New A` as a complete
* object_creation_expression (no argument list, no initializer) and `.B.C` as
* member accesses on it, so the enclosing invocation or indexing node is the
* real constructor call. True for that incomplete `New A` when a member access
* follows it; `New Foo().Bar()` creates a Foo and calls Bar, and `As New Foo`
* without parentheses constructs a Foo.
*
* The member access is recognised by the '.' after the node (blanks aside),
* not by ts_node_parent: that descends from the root, scanning siblings at
* every level, once per `New` in a WinForms InitializeComponent that holds
* thousands of them. Bytes are read only below the parsed tree's end minus
* one, which stays inside the source even when the parser was served an
* absent final newline (#2078). */
static bool vb_new_is_chain_prefix(TSNode creation, const char *source) {
TSNode ty = ts_node_child_by_field_name(creation, TS_FIELD("type"));
if (ts_node_is_null(ty) || strcmp(ts_node_type(ty), "array_type") == 0 ||
!ts_node_is_null(ts_node_child_by_field_name(creation, TS_FIELD("arguments"))) ||
!ts_node_is_null(ts_node_child_by_field_name(creation, TS_FIELD("initializer")))) {
return false;
}
uint32_t limit = ts_node_end_byte(ts_tree_root_node(creation.tree));
for (uint32_t i = ts_node_end_byte(creation); i + SKIP_ONE < limit; i++) {
if (source[i] != ' ' && source[i] != '\t') {
return source[i] == '.';
}
}
return false;
}

/* The constructed type of a `New A.B.C` chain prefix (vb_new_is_chain_prefix)
* that no call encloses: `sb = New Text.StringBuilder` has no argument list,
* so no invocation or indexing node names the type. NULL when the dotted run
* is followed by '(' -- the enclosing call names it then (vb_callee). */
static char *vb_new_chain_without_call(CBMArena *a, TSNode creation, const char *source) {
TSNode ty = ts_node_child_by_field_name(creation, TS_FIELD("type"));
uint32_t start = ts_node_start_byte(ty);
uint32_t limit = ts_node_end_byte(ts_tree_root_node(creation.tree));
uint32_t end = start;
while (end + SKIP_ONE < limit) {
unsigned char c = (unsigned char)source[end];
bool name_char = c == '_' || c == '.' || (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') ||
(c >= '0' && c <= '9');
if (!name_char) {
break;
}
end++;
}
if (end == start || (end + SKIP_ONE < limit && source[end] == '(')) {
return NULL;
}
return cbm_arena_strndup(a, source + start, (size_t)(end - start));
}

/* Type name text with generic and array suffixes cut (`List(Of T)` -> "List"). */
static char *vb_strip_type_suffix(char *text) {
if (!text) {
return NULL;
}
char *paren = strchr(text, '(');
if (paren) {
*paren = '\0';
}
return text[0] ? text : NULL;
}

/* VB.NET callee text for a call node (vb_call_types in lang_specs.c), NULL
* when the node names no callee.
* - invocation_expression `F()` names it in `function`, and
* array_access_expression `F(x)` in `array`: VB writes calls and indexing
* alike, and the grammar reads a call with arguments as indexing.
* - `Me.X()` / `MyClass.X()` are self-calls: the member name resolves like a
* bare same-class call. The receiver is matched by node kind, so its
* spelling (`me.`, `ME.`) does not matter in a case-insensitive language.
* - object_creation_expression names the constructed type; an empty argument
* list reads as an array rank (`New Customer()`), so an array_type there is
* the type's element_type. See vb_new_is_chain_prefix for `New A.B.C()`. */
static char *vb_callee(CBMArena *a, TSNode node, const char *source, const char *nk) {
if (strcmp(nk, "object_creation_expression") == 0) {
if (vb_new_is_chain_prefix(node, source)) {
return vb_new_chain_without_call(a, node, source);
}
TSNode ty = ts_node_child_by_field_name(node, TS_FIELD("type"));
if (!ts_node_is_null(ty) && strcmp(ts_node_type(ty), "array_type") == 0) {
ty = ts_node_child_by_field_name(ty, TS_FIELD("element_type"));
}
return ts_node_is_null(ty) ? NULL : vb_strip_type_suffix(cbm_node_text(a, ty, source));
}
TSNode callee = strcmp(nk, "invocation_expression") == 0
? ts_node_child_by_field_name(node, TS_FIELD("function"))
: ts_node_child_by_field_name(node, TS_FIELD("array"));
if (ts_node_is_null(callee)) {
return NULL;
}
if (strcmp(ts_node_type(callee), "member_access_expression") == 0) {
TSNode obj = ts_node_child_by_field_name(callee, TS_FIELD("object"));
const char *ok = ts_node_is_null(obj) ? "" : ts_node_type(obj);
if (strcmp(ok, "me_expression") == 0 || strcmp(ok, "myclass_expression") == 0) {
TSNode member = ts_node_child_by_field_name(callee, TS_FIELD("member"));
return ts_node_is_null(member) ? NULL : cbm_node_text(a, member, source);
}
/* Walk the access chain to its root; `New A` there makes this call
* the constructor of A.B.C, spelled from the type to the chain end. */
TSNode root = obj;
while (!ts_node_is_null(root) &&
strcmp(ts_node_type(root), "member_access_expression") == 0) {
root = ts_node_child_by_field_name(root, TS_FIELD("object"));
}
if (!ts_node_is_null(root) &&
strcmp(ts_node_type(root), "object_creation_expression") == 0 &&
vb_new_is_chain_prefix(root, source)) {
TSNode ty = ts_node_child_by_field_name(root, TS_FIELD("type"));
uint32_t start = ts_node_start_byte(ty);
uint32_t end = ts_node_end_byte(callee);
return end > start ? vb_strip_type_suffix(
cbm_arena_strndup(a, source + start, (size_t)(end - start)))
: NULL;
}
}
return cbm_node_text(a, callee, source);
}

static char *extract_callee_lang_specific(CBMArena *a, TSNode node, const char *source,
CBMLanguage lang) {
const char *nk = ts_node_type(node);
Expand Down Expand Up @@ -2550,6 +2671,14 @@ static char *extract_callee_name(CBMArena *a, TSNode node, const char *source, C
return extract_pkl_callee(a, node, source, ts_node_type(node));
}

/* VB.NET: resolve here and return unconditionally, like Pkl. The generic
* constructor path would name `New System.Windows.Forms.Button()` after
* its misparsed `New System` prefix, and the first-identifier fallback
* would turn indexing into calls of anything. NULL means "not a call". */
if (lang == CBM_LANG_VISUALBASIC) {
return vb_callee(a, node, source, ts_node_type(node));
}

// Helm / Go templates: resolve `include "x"` / `template "x"` to the
// referenced named template so it links to the define'd Function (#338).
if (lang == CBM_LANG_GOTEMPLATE) {
Expand Down
Loading
Loading