GitNexus/gitnexus/vendor/tree-sitter-lua/bindings/node/index.js
taoxin 6deba51db0 feat(languages): add Lua language support
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>
2026-08-24 16:47:30 +08:00

7 lines
201 B
JavaScript

const root = require("path").join(__dirname, "..", "..");
module.exports = require("node-gyp-build")(root);
try {
module.exports.nodeTypeInfo = require("../../src/node-types.json");
} catch (_) {}