feat(visualbasic): add VB.NET structural extraction (WinForms-grade)#1179
Open
ankitsusheel wants to merge 5 commits into
Open
feat(visualbasic): add VB.NET structural extraction (WinForms-grade)#1179ankitsusheel wants to merge 5 commits into
ankitsusheel wants to merge 5 commits into
Conversation
Vendor CodeAnt-AI/tree-sitter-vb-dotnet (MIT, ABI 15, no external scanner) pinned at cfca210, as internal/cbm/vendored/grammars/vb_dotnet/. parser.c is regenerated (tree-sitter-cli 0.25.6) from a locally patched grammar.js: upstream at the pinned commit cannot parse several core VB.NET forms — next-line/colon Inherits/Implements clauses, Handles clauses, AddHandler/RemoveHandler/RaiseEvent statements, As New initializers, member-level #Region directives, nested types, and attribute-with-line-continuation before declarations (the standard WinForms Designer file shape). The full diff against upstream is vendored as vb_dotnet/grammar.js.patch alongside the patched grammar.js; MANIFEST.md documents the re-vendor procedure. Upstream declares MIT in package.json/tree-sitter.json but ships no LICENSE file; the vendored LICENSE carries the standard MIT text for the declared license, per the move/zsh convention in MANIFEST.md. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Signed-off-by: Ankit Susheel <ankitsusheel@gmail.com>
Register CBM_LANG_VISUALBASIC (.vb, display name "VB.NET") with a lang_specs.c row (CBM_LANG_CSHARP as template) over the vb_dotnet grammar's node kinds, plus the per-language handling the generic paths cannot cover: - extract_defs.c: VB blocks have no body wrapper node — find_class_body returns the block itself and push_class_body_children routes through the nested-class scan so members are not double-extracted as top-level functions. interface_block/enum_block get Interface/Enum labels (Module/Structure stay Class, matching the C# struct labeling). Sub New constructors carry no name node — emitted as Method "New" via a new push_method_def_named split of push_method_def. Base classes are collected from inherits_clause/implements_clause type children (generic (Of T) suffixes stripped), which feeds the existing generic INHERITS-vs-IMPLEMENTS decision in pass_semantic.c. Fields/properties: field_declaration declarators and property_declaration emit Field defs with the as_clause type (including the As New shorthand), so WinForms WithEvents controls become graph nodes and Handles/AddHandler identifier references resolve to them as USAGE edges via the existing usage machinery. - extract_calls.c: invocation carries its callee in a target field (identifier or member_access) and new_expression in type; Me./MyClass. receivers are stripped so self-calls resolve like bare same-class calls. Namespaces stay QN-transparent, matching the established C# behavior. Partial classes keep one node per file (path-derived QNs), also matching C#. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Signed-off-by: Ankit Susheel <ankitsusheel@gmail.com>
…ADME Eleven extraction tests (declarations incl. WinForms Designer shapes, class-scoped method QNs, next-line Inherits/Implements, dotted external bases, Sub New constructors, calls incl. Me-receiver stripping and As New, #Region tolerance, Handles/AddHandler with the AddressOf handler reference, imports, nested classes), a grammar-regression fixture row, a label golden, and .vb detection tests. README gains VB.NET in the "Also supported (not yet benchmarked)" tier and the language count moves 158 -> 159. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Signed-off-by: Ankit Susheel <ankitsusheel@gmail.com>
cppcheck(knownConditionTrueFalse): - extract_defs.c: remove redundant inner `if (base[0])` — base[0] is guaranteed non-zero inside the outer `if (base && base[0])` guard; the intervening *paren='\0' only truncates mid-string. - extract_calls.c: simplify `return t[0] ? t : NULL` to `return t` for the same reason — t[0] is always true at that point. license-gate(audit-license-provenance): - Add vb_dotnet to SPECIAL_NOTICE so the byte-identity audit resolves it as MANUAL-VERIFIED instead of ERROR. Upstream CodeAnt-AI/tree-sitter-vb-dotnet declares MIT in package metadata but ships no LICENSE file; the vendored LICENSE carries the standard MIT text (matching the move/zsh convention used for pine/ISC). Signed-off-by: Ankit Susheel <ankitsusheel@gmail.com>
clang-format-20 requires the opening brace on its own line when the array initializer spans multiple lines; the previous column-aligned style triggered [-Wclang-format-violations]. Auto-corrected with clang-format; verified lint-ci passes locally. Signed-off-by: Ankit Susheel <ankitsusheel@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1178
Adds VB.NET (
.vb) as a supported language, with real-world WinForms code as the acceptance bar. Before this change,.vbfiles were silently dropped at discovery —status:"indexed", zero nodes, zero warnings, no counter (verified onmain; see the issue for the baseline evidence).What's in here (3 commits)
CodeAnt-AI/tree-sitter-vb-dotnet(MIT declared, ABI 15, no external scanner) pinned atcfca210, vendored underinternal/cbm/vendored/grammars/vb_dotnet/.Inherits/Implements,Handlesclauses,AddHandler/RemoveHandler/RaiseEvent,As New T(), member-level#Region, nested types, or attribute_-continuations (the Designer-file shape).parser.cis regenerated (tree-sitter-cli 0.25.6) from a patchedgrammar.js; the full diff is vendored asgrammar.js.patch, with the re-vendor procedure in MANIFEST.md. Patches to be proposed upstream. Upstream ships no LICENSE file (MIT metadata only) — vendored LICENSE carries the standard MIT text per themove/zshconvention.CBM_LANG_VISUALBASIC,.vbextension mapping,lang_specs.crow, and the per-language handling the generic paths can't cover: body-wrapper-less class blocks (member routing + no double extraction),Sub Newconstructors (no name node → Method "New" via a smallpush_method_defsplit),inherits_clause/implements_clausebase collection feeding the existing generic INHERITS-vs-IMPLEMENTS decision, Field defs fromvariable_declarator/property_declarationwithas_clausetypes (incl.As New), and callee extraction frominvocation'stargetfield withMe./MyClass.receiver stripping.#Region, Handles/AddHandler, constructors, calls, imports, nested types), grammar-regression row, label golden,.vbdetection tests, README tier entry, 158→159 language count.Design decisions for maintainer review
partialgets today; no merge pass. Cross-file wiring verified working via name resolution (aHandlesreference inForm1.vbresolves to theWithEventsfield inForm1.Designer.vb).registry.cuntouched. Names emitted as written; mixed-case references are a documented limitation.USAGEmachinery — no new edge type;HANDLESstays route-scoped.Verification
scripts/security-vendored.sh --updateafter its dangerous-code scan passed.IMPLEMENTSedge, class-scoped Method QNs, Field nodes with control types, andtrace_pathwalkingButton1_Click → CustomerService → Save → Validate.Diff-size note
The reviewable hand-written diff is ~500 lines across
extract_defs.c/extract_calls.c/lang_specs.c/language.c/tests/docs. The bulk of the line count is the generatedparser.c(vendored, machine-generated) — same shape as prior grammar additions (e.g. objectscript).🤖 Generated with Claude Code