Add Lua as a supported language with symbol extraction and scope-resolution
at parity with existing languages.
Vendored grammar:
- Vendor tree-sitter-lua (v2.1.3, MIT). Upstream ships nan-based node
bindings incompatible with the pinned tree-sitter@0.21.1 runtime
(setLanguage rejects with "Invalid language object"), so the grammar C
sources are rebuilt against a Napi binding adapted from tree-sitter-c.
Symbol extraction (legacy tree-sitter queries):
- Function, Method, and Class definitions; call sites.
Scope-resolution (CALLS + IMPORTS edges):
- emitScopeCaptures, interpretImport, and a Lua ScopeResolver registered
in the scope-resolution pipeline.
- Import resolution via a SuffixIndex so root-level modules (e.g.
require("middleclass")) resolve, not just dotted paths.
Class structure (EXTENDS + HAS_METHOD + METHOD_OVERRIDES):
- middleclass class("Name", Parent) and function Class:method() handled
via a heritage edge hook (emitHeritageEdges), since middleclass has no
syntactic class body for the standard heritage/ownership walk.
Registered in all dispatch tables (SupportedLanguages enum, language
detection, parser-loader, parse-worker languageMap, language
classification, scope-resolver registry, vendored-grammar manifest).
Verified: tsc --noEmit clean; analyze on a Lua sample produces Class,
Method, EXTENDS, HAS_METHOD, METHOD_OVERRIDES, IMPORTS, and CALLS.
Co-Authored-By: Claude Sonnet 4 <noreply@anthropic.com>
|
||
|---|---|---|
| .. | ||
| lbug-fts | ||
| leiden | ||
| tree-sitter-c | ||
| tree-sitter-dart | ||
| tree-sitter-kotlin | ||
| tree-sitter-lua | ||
| tree-sitter-objc | ||
| tree-sitter-proto | ||
| tree-sitter-swift | ||
| tree-sitter-zig | ||
| README.md | ||
Vendored Tree-sitter grammars
These grammars use the bundled Tree-sitter 0.25.1 runtime (ABI 13–15). Generated C sources and scanners must be copied from upstream; never patch them by hand. JavaScript/TypeScript compatibility adapters belong in GitNexus.
| Grammar | Version / snapshot | Upstream source commit |
|---|---|---|
| c | 0.24.2-gb780e47 |
b780e47fc780 |
| dart | 1.0.0-gbe07cf7 |
be07cf7118d3 |
| proto | 0.6.0-gd7d1542 |
d7d15427321d |
| kotlin | 0.4.0-g1852ea1 |
1852ea17b7f6 |
| objc | 3.0.2-g181a81b |
181a81b8f23a |
| zig | 1.1.2-g6479aa1 |
6479aa13f32f |
| swift | 0.7.2 |
7b7909f2f6b9 |
Swift 0.7.2 is the newest release that passes our declaration-ownership tests.
Both 0.7.3 and 0.7.4 move a later top-level struct inside an earlier class after
a conditional group splits a function header. That input is invalid Swift,
but preserving recovery for partial source is an existing GitNexus contract.
The hold in .github/vendored-grammars.json remains until the real-parser and
worker-pipeline tests in tree-sitter-languages.test.ts and
swift-conditional-directive.test.ts pass with a newer upstream grammar.
No generated source was patched to preserve this behavior.
To refresh a grammar:
- Resolve an immutable upstream commit (Swift publishes generated sources on
*-with-generated-filestags). Copysrc/runtime/build inputs andbindings/node/binding.ccbyte-for-byte. Keep the GitNexus CommonJS loader andbinding.gyp; upstream C's ESM loader uses top-level await and cannot be substituted into the synchronous worker import path. - Update the vendor package version,
_upstreamCommit,_vendoredBy, this table and any hold in.github/vendored-grammars.json. GitHub snapshots use<upstream-version>-g<sha7>so the monitor recognizes the installed commit. - Run semantic tests, including CFG and call/reference resolution. Successful loading, parsing or definition captures alone do not prove compatibility.
- Let
build-tree-sitter-prebuilds.ymlrebuild and execute the grammar on all six{linux,darwin,win32}-{x64,arm64}hosts. Check the installed tarball too; it must include the regenerated binaries and runtime metadata. Source builds use the repository checkout, which also contains the build inputs.
Protobuf's upstream syntax node collides with node-tree-sitter 0.25.1's
JavaScript SyntaxNode subclass generator. Its gRPC plugin uses a private
metadata wrapper to retain the native node and field/query APIs without
changing upstream sources. Native loading and comment/string-safe fallback
extraction are covered in test/unit/group/grpc-extractor.test.ts.