feat(lang): add Visual Basic 6 / VBA grammar (harumiWeb/tree-sitter-vba) - #2086
feat(lang): add Visual Basic 6 / VBA grammar (harumiWeb/tree-sitter-vba)#2086Tokarzewski wants to merge 1 commit into
Conversation
|
Thanks for opening this — it has been seen, and it is queued. This note is automated, but it is not a brush-off: it exists so you know where your PR stands instead of having to guess from silence. Current review status: working through a backlog. What that means for this PR, concretely:
Things that will genuinely speed it up whenever review does happen:
If this fixes a bug, a reproduction we can run is worth more than a description of the symptom. Thanks for contributing, and sorry in advance for the wait. |
Vendors tree-sitter-vba @ 63b2f8d0d65c (v0.13.0, MIT, ABI 15, lexer-only, no external scanner) as CBM_LANG_VB6 and wires it end to end: - discover: .bas/.ctl/.dsr/.pag map directly; .cls (Apex/ObjectScript) and .frm (FORM) keep their table owners and the DeusData#2074 content sniffers now route VB6 modules to CBM_LANG_VB6 instead of CBM_LANG_COUNT. - lang_specs: Sub/Function/Property Get|Let|Set/Declare/Event as callables; Type -> Class with typed Fields (As clause unwrapped); Enum -> Enum with members; module-level Dim/Const -> one Variable per declarator; call_statement/call_expression/raise_event_statement callees; Implements as import; VB6 keyword set; source_file module parents. - release surfaces: MANIFEST (163 grammars, 75x ABI-15, vba row + note on the locally generated parser.c), THIRD_PARTY, vendored checksums, new-languages.json, and the 162 -> 163 language-count claims on all seven contract surfaces. - tests: extension/sniff mapping, grammar regression + label golden, calls contract, extraction block, and the four repro registries (capability ledger, call-node manifest, invariant breadth, argument matrix B). Class-module synthesis (.cls/.frm as a Class with Methods) is a separate follow-up change. Refs DeusData#721. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Signed-off-by: Tokarzewski <bartlomiej.tokarzewski@gmail.com>
b9d550b to
2082b2d
Compare
|
Thank you for contributing the VB6/VBA grammar integration and recording its upstream source. We need more time to review the generated parser's provenance, licensing, reproducibility and integration before giving a decision. The size of a generated parser is not, by itself, a judgment about the contribution. The review queue is currently full, so detailed feedback may take a little time. We are working through it carefully and appreciate the work you have put into supporting the project. Thank you for your patience. |
|
@DeusData happy to help, please let me know if there is anything else I could help you with. |
What does this PR do?
Adds Visual Basic 6 / VBA as a language (
CBM_LANG_VB6) — part two of #721, following the merged short-term disambiguation in #2074. The VB6.frm/.clsfiles that #2074 routed to "unsupported" now parse with a real grammar;.bas/.ctl/.dsr/.pagare mapped directly.Refs #721.
Grammar: harumiWeb/tree-sitter-vba @
63b2f8d0d65c(v0.13.0, MIT, ABI 15, lexer-only — no external scanner). It parses the module export headers natively (VERSION,Begin … End,BeginProperty … EndProperty, GUID blocks,Attributelines), so the.frmdesigner block flagged in #721 as the main technical risk needs no preprocessing step — it becomes ordinaryfrm_begin_blocknodes and the code below parses normally. VB6-specific statements are covered (Declare,Implements,Event/RaiseEvent,WithEvents,Property Get|Let|Set). Rejected alternatives: arrmee-wt/tree-sitter-vba (GPL-3.0 — outsidescripts/license-policy.json), joannefan/tree-sitter-vb6 (no licence file, no generated parser,.frmmetadata "poorly parsed" per its README), CodeAnt-AI/tree-sitter-vb-dotnet (VB.NET — that is #1073).Provenance caveat — please decide: upstream gitignores
src/parser.c, so the vendored 46 MBparser.cwas generated from the pinnedgrammar.jswithtree-sitter-cli 0.26.9(tree-sitter generate --abi 15, the project's ownpnpm generate). Byte-identity with an upstream artefact therefore cannot be claimed;MANIFEST.mdrecords the exact regeneration command (the vba row is markedNOT-IN-REGISTRIES (see note)). The size comes from per-keyword case-insensitive expansion;lean's parser is 102 MB, so it is within precedent.Extraction (generic paths plus small language hooks):
Sub/Function/Property Get|Let|Set/conditional_*_declaration/Declare Sub|Function/Event→ callables (every kind exposes anamefield).Type … End Type→ Class with typed Fields (Asclause unwrapped, so a Field isLong, notAs Long);Enum→ Enum with members; module-levelDim/Const→ one Variable per declarator;Implements→ import.call_statement(calleefield —Foo 1,Call Foo(1),obj.Bar x),call_expression(functionfield —y = Foo(1); VB6 syntax cannot distinguish this from array indexing, unresolved callees just produce no edge),raise_event_statement(event). Dottedobj.Methodis kept dotted; With-block.Methodyields the bare member name; nesteda(1)(2)is unwrapped.cbm_is_keyword;source_fileas module parent.Everything a new grammar needs here (modelled on #1888): enum,
lang_specs.crow, language table (the #2074 sniffers now returnCBM_LANG_VB6;discover.hdocs updated),userconfig.cnames (vb6,vba,vb,visualbasic), tests (test_language.c, grammar regression case + label golden,lang_contractCALL case,test_extraction.c), the four repro registries, the seven language-count surfaces 162→163 (README.md,docs/index.html,docs/llms.txt,pkg/npm/README.md, chocolatey nuspec,scripts/package-release.sh,server.json) withtests/test_language_count_contract.shpassing,MANIFEST.md(row, ABI tally recounted from the tree, re-vendor note, custom-extraction-handling entry),THIRD_PARTY.md,scripts/vendored-checksums.txt(sha256 of the LF index blobs),scripts/new-languages.json..gitattributesalready coversgrammars/**/parser.c.Deliberately not in this PR: treating
.cls/.frm/.ctlfiles as classes (Class node + Methods) — that is the separate draft #2087, stacked on this one so it can be reviewed or declined independently. Also out of scope:.vbs(no header markers),.vbp/.vbgproject files, VB.NET (#1073).Known grammar gaps (lines reported as
parse_partial; the files still index): a call with a leading omitted argument (.Add , x),Print #f, …, graphicsLine (x, y)-(x2, y2),_-continued comments, and the.frmheaderObject = "{GUID}…"lines.With the grammar in place VB6 files no longer "vanish silently" (the note on #2074), which largely dissolves that follow-up.
Checklist
git commit -s)language discover extraction grammar_regression grammar_labels lang_contract→ 737 passed, 0 failed, 2 Windows platform skips;repro_language_registry repro_call_node_manifest repro_call_argument_matrix_b→ 58 passed;repro_invariant_breadth→ PASS (vb6 calls=1 callable=1 module=0);bash tests/test_language_count_contract.sh→ 163 grammars, 7 surfaces OK. CI's sanitised runs are the authoritative check.clang-format-20 --dry-run --Werrorclean on every touchedsrc/andinternal/cbmfile; cppcheck not run locally (not installed) — relying on CI