Files
Colby Mchenry e32135171e feat(kernel): R7b Lua+Luau walker — one lua module, vendored-grammar-C lua v0.4.1, tree-sitter-luau 1.2.0 pin, both default-routed (#1384)
R7b batch 4 #2 (docs/design/lua-luau-kernel-port-checklist.md is the
authoritative quirk list). ONE walker for both dialects (ccpp precedent) —
the differences are exactly four: luau's type_definition aliases, the
`export `-slice isExported hook, the return-type signature suffix, and the
grammar handle.

Grammar prep is kernel-side only, no wasm change: lua is the SECOND
vendored-grammar-C language (the vendored wasm is the v0.4.1 tag, a revision
not on crates.io — tag artifacts compiled via build.rs, shas pinned); luau
is a plain crate pin =1.2.0 whose tarball is sha-identical to the tag (the
swift tag≠crate divergence does not recur). Grammar-parity rows replace the
bump gate entirely.

Preserved bug-for-bug (all probe-pinned): the require/visitNode-hook
ASYMMETRIES (top-level requires — including inside top-level if/for/while —
mint import nodes while the identical body-level statement emits
`calls "require"`; top-level `local x = foo()` initializers are invisible
while global `x = foo()` calls emit), the BFS string-win inside require args
(`require(script:WaitForChild("Kid"))` → import Kid) and Roblox instance
paths, receiver-QN methods (`M.sub.deep::chained`, `_G::installed`,
stack-QN nested globals like `render::leakedGlobal`), the raw-text callee
world (colon forms with `self` never stripped, bracket callees,
newline-glued chains byte-verbatim, the `(handler)` paren-conversion),
LUA_SPEC function-as-value capture with the `M.cb = cb` param-storage skip
and first-occurrence dedupe, LuaDoc `---` keeping a leading `- ` plus
`--!strict` joining docstring chains (block-comment docstrings keep interior
CRLF bytes), variable nodes at the IDENTIFIER with positional value pairing,
duplicate same-(kind,name,line) ids, and the lua↔luau isExported wire
divergence (lua functions: flag absent; luau functions: present-false;
methods: absent in both; variables: present-false in both; `export type`:
true).

Gates: parity sweeps first-run 0-diff on kong/lazy.nvim/lua-resty-core
(lua) + lune/Fusion (luau) — 1,734 clean files byte-parity, deferrals
1/0/0/3/8 matching the survey's both-arm predictions exactly (kong's 1 = a
deliberately invalid fixture; luau's = grammar-inherent generic type packs
and default type params); full-init dumps byte-identical kernel-vs-wasm ×4
(kong 157,650 dump lines); kernel-lua-parity suite (both torture fixtures +
in-memory CRLF variants + glue-chain, duplicate-id, and cross-dialect defer
pins + kernel-arm wire-flag pins); full suite 2,647 green ×2 with
CODEGRAPH_KERNEL_EXPECT=1. DEFAULT_ROUTED += lua, luau (18 langs).

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-07-20 18:42:14 -05:00

73 lines
3.0 KiB
TOML

[package]
name = "codegraph-kernel"
version = "0.1.0"
edition = "2021"
license = "MIT"
publish = false
description = "Native extraction kernel for CodeGraph — tree-sitter parse+extract with one JS boundary crossing per file"
[lib]
crate-type = ["cdylib"]
[dependencies]
napi = { version = "3", default-features = false, features = ["napi8"] }
napi-derive = "3"
tree-sitter = "0.25"
sha2 = "0.10"
regex = "1"
# Grammars — MUST stay revision-matched with the wasm grammars the fallback
# path loads (tree-sitter-wasms npm package / src/extraction/wasm/). The
# kernel-grammar-parity test asserts node-kind-table equality at test time;
# bump these together with the wasm side or that gate fails.
tree-sitter-typescript = "0.23"
tree-sitter-javascript = "0.25"
tree-sitter-java = "0.23"
tree-sitter-python = "0.23"
tree-sitter-go = "0.23"
# Pinned exact: the vendored wasm (src/extraction/wasm/) was built from these
# tags' checked-in parser.c, sha-matched against these registry tarballs
# (R7a prep, #1345). A patch bump here without re-vendoring breaks the match.
tree-sitter-c = "=0.24.2"
tree-sitter-cpp = "=0.23.4"
tree-sitter-rust = "=0.24.2"
# csharp: the vendored wasm (#717) predates the kernel and was verified
# table-identical to this crate's tarball (ABI 15, STATE_COUNT 8053, node-kind
# and field tables — csharp checklist header). Bump crate + wasm together.
tree-sitter-c-sharp = "=0.23.5"
# ruby: content bump, ABI stays 14 (the v0.23.1 tag predates the ABI-15
# generator) — kernel-grammar-parity asserts same-revision, not same-ABI.
tree-sitter-ruby = "=0.23.1"
# php: the walker calls LANGUAGE_PHP (the full HTML-interleaving variant the
# wasm ships) — NEVER LANGUAGE_PHP_ONLY, which errors on leading HTML.
tree-sitter-php = "=0.24.2"
# swift: the vendored wasm is built from THIS crate's tarball src/ (the tag's
# checked-in parser.c is an older ABI-14 generation that can never sha-match;
# grammar.json rules are JSON-equal — swift checklist header). parser.c is
# ~20MB generated — expect slow compiles.
tree-sitter-swift = "=0.7.3"
# r: the vendored wasm IS r-lib v1.2.0 and this crate's tarball ships both
# generated artifacts sha-identical to the tag (parser.c 6221657347…,
# scanner.c 1209d11076… — r checklist §Grammar prep). ABI 14 (the tag
# predates the ABI-15 generator) — parity asserts same-revision, not
# same-ABI (ruby precedent). Bump crate + wasm together.
tree-sitter-r = "=1.2.0"
# luau: the vendored wasm IS tree-sitter-grammars v1.2.0 and this crate's
# tarball ships parser.c/scanner.c sha-identical to the tag (8f25bc17… /
# a157bb52… — lua-luau checklist §Grammar prep). ABI 14. Lua itself is
# vendored C (build.rs) — its v0.4.1 revision is not on crates.io.
tree-sitter-luau = "=1.2.0"
# tree-sitter-language: the version-agnostic LanguageFn shim for the vendored
# kotlin grammar C (see build.rs — no kotlin crate dep is possible).
tree-sitter-language = "0.1"
[build-dependencies]
napi-build = "2"
cc = "1"
[profile.release]
lto = true
codegen-units = 1
strip = "symbols"