47dfdf305c
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>
43 lines
2.1 KiB
Rust
43 lines
2.1 KiB
Rust
fn main() {
|
|
napi_build::setup();
|
|
|
|
// Kotlin grammar — vendored C, compiled here instead of a crate dep: the
|
|
// crates.io tree-sitter-kotlin 0.3.8 pins `tree-sitter >= 0.21, < 0.23`
|
|
// (the kernel links 0.25) and tree-sitter-kotlin-ng is a DIFFERENT
|
|
// grammar (8 fields vs 0, renamed kinds — extractor-breaking). Sources
|
|
// are the fwcd 0.3.8 tag's checked-in generated artifacts, sha-matched
|
|
// against the crates.io tarball (kotlin checklist §Grammar prep):
|
|
// parser.c 54104a7ef1555c265b746c790e0f8bb953cc17806e9df0c3af82f7f62c06a70a
|
|
// scanner.c 27f73337ec357fc341fa57538f34c14277b0346980c3405dc30beab6202ec6d0
|
|
// Flags crib the tarball's own bindings/rust/build.rs.
|
|
let mut c = cc::Build::new();
|
|
c.include("grammars/kotlin");
|
|
c.file("grammars/kotlin/parser.c");
|
|
c.file("grammars/kotlin/scanner.c");
|
|
c.flag_if_supported("-Wno-unused-parameter");
|
|
c.flag_if_supported("-Wno-unused-but-set-variable");
|
|
c.flag_if_supported("-Wno-trigraphs");
|
|
c.flag_if_supported("-utf-8"); // msvc
|
|
c.compile("tree-sitter-kotlin");
|
|
println!("cargo:rerun-if-changed=grammars/kotlin");
|
|
|
|
// Lua grammar — vendored C (second vendored-grammar-C language): the
|
|
// vendored wasm is tree-sitter-grammars/tree-sitter-lua v0.4.1 (tag
|
|
// 816840c592), which is NOT on crates.io (only 0.1/0.2/0.5 exist; 0.5.0
|
|
// adds Lua-5.5 `global` — a future bump with its own gate). Sources are
|
|
// the v0.4.1 tag's checked-in generated artifacts, sha-recorded in the
|
|
// lua-luau checklist §Grammar prep:
|
|
// parser.c b34a362e43f0311f405721f3089e94f97f31da403b154d456d093e64609a4081
|
|
// scanner.c 35bbd630b5a7421d46d2e91185eeea09bf78565d44cb676b63ca20d0f1b54bbd
|
|
let mut lua = cc::Build::new();
|
|
lua.include("grammars/lua");
|
|
lua.file("grammars/lua/parser.c");
|
|
lua.file("grammars/lua/scanner.c");
|
|
lua.flag_if_supported("-Wno-unused-parameter");
|
|
lua.flag_if_supported("-Wno-unused-but-set-variable");
|
|
lua.flag_if_supported("-Wno-trigraphs");
|
|
lua.flag_if_supported("-utf-8"); // msvc
|
|
lua.compile("tree-sitter-lua");
|
|
println!("cargo:rerun-if-changed=grammars/lua");
|
|
}
|