Sixth R7b port — the T1½ batch finale. Checklist-first recipe
(docs/design/kotlin-kernel-port-checklist.md, 1,121 lines, dist-extractor
ground truth); parity passed FIRST RUN on all three repos.
THE NOVEL MECHANISM — vendored-grammar-C (the §4 tracker's prescription,
first use): 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), so no crate dep
is possible. The fwcd 0.3.8 tag's sha-matched parser.c + scanner.c are
vendored into codegraph-kernel/grammars/kotlin and compiled by build.rs (cc),
exposed via tree-sitter-language::LanguageFn. The wasm re-vendor is
behavior-NEUTRAL (0 CST/error disagreements across 1,984 gate-repo files;
old-vs-new full-init dumps byte-identical ×3) — a reproducibility re-vendor,
ABI stays 14.
Walker firsts: extension-function receivers (getReceiverType →
`WidgetK::extend` QN OVERRIDE with no package prefix, the qualified-receiver
`com::qext` first-segment bug, and the owner-contains fallback that excludes
`interface` kinds and is source-order dependent) and extractModifiers
(expect/actual platform modifiers → the node DECORATORS wire field on every
created node — the KMP synthesizer's feed, incl. `actual typealias`).
Preserved bug-for-bug: the FIELD_COUNT-0 dead cluster (no signatures, ZERO
type-annotation refs), hook-consumed property initializers emitting nothing
(incl. `by lazy {}`), the bodiless-vs-bodied class header asymmetry, enum-
entry bodies being invisible, KDoc never a docstring AND chain-breaking,
comment-gluing into import/package extents, `@Anno(args)` emitting nothing
while `@Marker` decorates, zero instantiates refs, the paren-then-lambda
`trailing()` garbage callee, text-includes visibility/suspend false
positives, and the packaged-file value-ref target drop. The fun-interface
misparse-recovery hook is DEFER-SHIELDED (every such file has_error) and
deliberately not ported. The swift-sweep lesson pre-applied: the shared
`assignment` shadow-prune case is implemented alongside the
property_declaration case.
Gates: sweeps 0-diff okio 299/322, okhttp 531/580, kotlinx.coroutines
1031/1082 (deferrals exactly the predicted 23/49/51 — both-arm grammar
reality incl. PHANTOM hasError files with complete CSTs; the kernel trusts
the flag); full-init dumps byte-identical ×3 (46.5k/108.9k/92.3k lines); KMP
expect/actual synthesis IDENTICAL across arms (412 edges on
kotlinx.coroutines — the tracker's KMP validation); kernel-kotlin-parity
suite (torture reflowed off the phantom shapes + .kts script + CRLF variants
+ fun-interface and phantom defer pins) + kotlin grammar-parity row (the
C-build ↔ wasm table identity proof); full suite 2,633 green ×2 under
CODEGRAPH_KERNEL_EXPECT=1. DEFAULT_ROUTED += kotlin (15 langs).
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
62 lines
2.3 KiB
TOML
62 lines
2.3 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"
|
|
|
|
# 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"
|