feat(kernel): R7b C# walker — csharp module, tree-sitter-c-sharp 0.23.5 pin, csharp default-routed (#1378)
Second R7b port, checklist-first recipe (docs/design/csharp-kernel-port-checklist.md; parity passed FIRST RUN again). No grammar bump — the #717 vendored wasm verified table-identical to crate 0.23.5 (ABI 15, STATE_COUNT 8053, node-kind + field tables); first port with no grammar-prep step. The #237 #if-blanking preParse stays TS-side via the existing route-point hoist. Walker preserves bug-for-bug: the single-namespace-node quirks (second namespace nests under the first, nested namespaces leave no trace, import refs hang off the namespace node), raw member-access callee texts (this./base./literal receivers, multi-line fluent chains) with unconditional chain re-encode, deliberate emission holes (property accessor/expression bodies, ctor initializers, delegates/events/ operators/indexers/local functions, top-level locals), garbage extends refs ((repo) primary-ctor args, BaseDto(Name) record bases, enum : byte), the alias- import moduleName quirks, nameof-as-call, CSHARP fn-ref spec (+= subscription, this.X bare-name form, argument layer, initializer lists), C# type-ref engine (nested-generic returnType failure included), and value-ref shadow pruning. Gates: sweeps 0-diff serilog 211/216 / Newtonsoft.Json 914/945 / jellyfin 2104/2105 (deferrals match the survey's per-repo predictions — both-arm #if damage; default --max-deferral 0.1 holds, no c/cpp exemption); full-init dumps byte-identical ×3 (14.0k/109.1k/210.8k lines); kernel-csharp-parity suite (torture ×3 + CRLF variants + 8 micro-pins + defer) + csharp grammar-parity row; full suite 2,608 ×2 under CODEGRAPH_KERNEL_EXPECT=1. DEFAULT_ROUTED += csharp (11 langs). Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Fable 5
parent
f1ca991943
commit
286e9ccc2d
Generated
+11
@@ -53,6 +53,7 @@ dependencies = [
|
||||
"sha2",
|
||||
"tree-sitter",
|
||||
"tree-sitter-c",
|
||||
"tree-sitter-c-sharp",
|
||||
"tree-sitter-cpp",
|
||||
"tree-sitter-go",
|
||||
"tree-sitter-java",
|
||||
@@ -495,6 +496,16 @@ dependencies = [
|
||||
"tree-sitter-language",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tree-sitter-c-sharp"
|
||||
version = "0.23.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c1aac67f1ad71de1d6d39708d34811081c26dfa495658de6c14c34200849357c"
|
||||
dependencies = [
|
||||
"cc",
|
||||
"tree-sitter-language",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tree-sitter-cpp"
|
||||
version = "0.23.4"
|
||||
|
||||
@@ -31,6 +31,10 @@ tree-sitter-go = "0.23"
|
||||
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"
|
||||
|
||||
[build-dependencies]
|
||||
napi-build = "2"
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -15,8 +15,8 @@ use tree_sitter::Language;
|
||||
|
||||
/// Languages this kernel binary can extract (reported by contractInfo;
|
||||
/// TS-side routing policy decides what actually routes).
|
||||
pub const LANGUAGES: [&str; 10] =
|
||||
["typescript", "tsx", "javascript", "jsx", "java", "python", "go", "c", "cpp", "rust"];
|
||||
pub const LANGUAGES: [&str; 11] =
|
||||
["typescript", "tsx", "javascript", "jsx", "java", "python", "go", "c", "cpp", "rust", "csharp"];
|
||||
|
||||
pub fn grammar_for(language: &str) -> Option<Language> {
|
||||
match language {
|
||||
@@ -33,6 +33,9 @@ pub fn grammar_for(language: &str) -> Option<Language> {
|
||||
"cpp" => Some(tree_sitter_cpp::LANGUAGE.into()),
|
||||
// R7b: v0.24.2, sha-matched with the vendored wasm (grammars.ts).
|
||||
"rust" => Some(tree_sitter_rust::LANGUAGE.into()),
|
||||
// R7b: 0.23.5, table-identical to the vendored ABI-15 wasm (#717;
|
||||
// verified against the crates.io tarball — csharp checklist header).
|
||||
"csharp" => Some(tree_sitter_c_sharp::LANGUAGE.into()),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
mod buffers;
|
||||
mod ccpp;
|
||||
mod cfnptr;
|
||||
mod csharp;
|
||||
mod docstring;
|
||||
mod ids;
|
||||
mod go;
|
||||
@@ -213,6 +214,7 @@ pub fn extract_file(file_path: String, content: String, language: String) -> Res
|
||||
"go" => go::extract(&file_path, &content).map_err(Error::from_reason)?,
|
||||
"c" | "cpp" => ccpp::extract(&file_path, &content, &language).map_err(Error::from_reason)?,
|
||||
"rust" => rustlang::extract(&file_path, &content).map_err(Error::from_reason)?,
|
||||
"csharp" => csharp::extract(&file_path, &content).map_err(Error::from_reason)?,
|
||||
_ => tsjs::extract(&file_path, &content, &language).map_err(Error::from_reason)?,
|
||||
};
|
||||
Ok(ExtractBuffers {
|
||||
|
||||
Reference in New Issue
Block a user