@willbooster/tree-sitter-c-sharp 2.0.2 → 3.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +20 -10
- package/package.json +6 -5
- package/tree-sitter-c_sharp.wasm +0 -0
- package/tree-sitter.json +1 -1
package/README.md
CHANGED
|
@@ -33,8 +33,7 @@ Known gaps:
|
|
|
33
33
|
|
|
34
34
|
The npm package ships `tree-sitter-c_sharp.wasm` for
|
|
35
35
|
[@willbooster/web-tree-sitter](https://www.npmjs.com/package/@willbooster/web-tree-sitter), which runs in Node.js, Bun,
|
|
36
|
-
browsers, and Cloudflare Workers. Use runtime version 1.
|
|
37
|
-
instantiation support for this grammar. Install the runtime alongside the grammar when using the Wasm parser; it
|
|
36
|
+
browsers, and Cloudflare Workers. Use runtime version 1.3.0 or later for the compact ABI 16 parser. Install the runtime alongside the grammar when using the Wasm parser; it
|
|
38
37
|
remains an optional peer for consumers that only use the grammar source or queries.
|
|
39
38
|
|
|
40
39
|
In Node.js and Bun, load it from the package:
|
|
@@ -80,13 +79,12 @@ The package also ships the queries in `queries/` and the node types in `src/node
|
|
|
80
79
|
|
|
81
80
|
In Rust, depend on the [crate](https://crates.io/crates/willbooster-tree-sitter-c-sharp) and on
|
|
82
81
|
[willbooster-tree-sitter](https://crates.io/crates/willbooster-tree-sitter), the runtime this package is tested and
|
|
83
|
-
fuzzed with
|
|
84
|
-
`tree-sitter` crate 0.27, whose error recovery never ends on some malformed input):
|
|
82
|
+
fuzzed with. The compact ABI 16 parser requires runtime 1.3.0 or later:
|
|
85
83
|
|
|
86
84
|
```toml
|
|
87
85
|
[dependencies]
|
|
88
|
-
tree-sitter = { package = "willbooster-tree-sitter", version = "1.
|
|
89
|
-
tree-sitter-c-sharp = { package = "willbooster-tree-sitter-c-sharp", version = "
|
|
86
|
+
tree-sitter = { package = "willbooster-tree-sitter", version = "1.3.0" }
|
|
87
|
+
tree-sitter-c-sharp = { package = "willbooster-tree-sitter-c-sharp", version = "3" }
|
|
90
88
|
```
|
|
91
89
|
|
|
92
90
|
```rust
|
|
@@ -111,16 +109,28 @@ runtime this package ships. The first run downloads that CLI from its GitHub Rel
|
|
|
111
109
|
`cargo` (with the `cmake` that `mise.toml` pins) when the download fails or the release has no binary that runs here. The `tree-sitter-cli` package provides
|
|
112
110
|
only the types of the grammar DSL that `grammar.js` checks against; its `tree-sitter` binary is upstream's.
|
|
113
111
|
|
|
112
|
+
`bun run generate` records a fresh ABI 16 generation profile from the applicable `test/corpus` cases and Git-tracked
|
|
113
|
+
files in `examples/`, then generates compact parser tables. The parser also embeds metadata from `tree-sitter.json`. After changing a grammar,
|
|
114
|
+
`tree-sitter.json`, a corpus case, or a tracked example,
|
|
115
|
+
regenerate and commit `src/`. Stage added or removed examples with `git add -A examples` before generation so the profile uses the intended file list.
|
|
116
|
+
Profiles in `.tmp/generation-profiles/` are temporary and must not be committed. `bun run build-wasm`, `bun run build/ci`,
|
|
117
|
+
and the release build regenerate the parsers before compiling them.
|
|
118
|
+
|
|
119
|
+
The tracked `examples/JsonWriter.cs` and `examples/JsonSerializerInternalWriter.cs` are verbatim MIT-licensed
|
|
120
|
+
snapshots from Newtonsoft.Json commit `52fa3aef1f2cadcd3a3f874251eddc98d3efbbaa`, under `Src/Newtonsoft.Json/`
|
|
121
|
+
and its `Serialization/` directory respectively. Refresh these training inputs independently of the clone pins in
|
|
122
|
+
`script/parse-examples` so changing a test checkout does not change profile training.
|
|
123
|
+
|
|
114
124
|
`bun run test` runs:
|
|
115
125
|
|
|
116
126
|
- the corpus in `test/corpus`, with the native build and with the Wasm build (the first run downloads the WASI SDK);
|
|
117
127
|
- an incremental-parsing check (`test/unit/incremental.test.ts`): `script/fuzz-corpus` runs `tree-sitter fuzz`, which
|
|
118
128
|
edits each corpus case at random, reparses it, undoes the edits, and reparses again. `TREE_SITTER_SEED`,
|
|
119
129
|
`TREE_SITTER_ITERATIONS`, and `TREE_SITTER_EDITS` run other or more edits;
|
|
120
|
-
- a check that the
|
|
121
|
-
`script/known-failures.txt`.
|
|
122
|
-
`script/parse-examples`. After
|
|
123
|
-
|
|
130
|
+
- a check that the C# files under `examples/` that fail to parse are exactly those listed in
|
|
131
|
+
`script/known-failures.txt`. Inputs include Git-tracked generation examples and pinned clones. The first run fetches the pinned repositories listed in
|
|
132
|
+
`script/parse-examples`. After adding, removing, or changing an example, changing the grammar, or moving a pin,
|
|
133
|
+
run `script/parse-examples` and review the failure-list diff before committing;
|
|
124
134
|
- a performance check (`test/unit/performance.test.ts`) that recovering from an error on each line takes linear time
|
|
125
135
|
(ten times the lines take about ten times the CPU time, under a ceiling), since consumers parse files while they are
|
|
126
136
|
being edited. It loads the Wasm build through @willbooster/web-tree-sitter, which `bun run build/ci` rebuilds after
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@willbooster/tree-sitter-c-sharp",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.1",
|
|
4
4
|
"description": "C# grammar for tree-sitter",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"incremental",
|
|
@@ -22,10 +22,11 @@
|
|
|
22
22
|
"*.wasm"
|
|
23
23
|
],
|
|
24
24
|
"scripts": {
|
|
25
|
-
"build-wasm": "script/
|
|
26
|
-
"build/ci": "
|
|
25
|
+
"build-wasm": "script/generate --build-wasm",
|
|
26
|
+
"build/ci": "bun run build-wasm",
|
|
27
27
|
"cleanup": "bun wb lint --fix --format",
|
|
28
28
|
"format": "bun wb lint --format",
|
|
29
|
+
"generate": "script/generate",
|
|
29
30
|
"lint": "bun wb lint",
|
|
30
31
|
"lint-fix": "bun wb lint --fix",
|
|
31
32
|
"prepare": "(bun lefthook install || true) && (test ! -f .lefthook/normalize-bun-lockfile.sh || bash .lefthook/normalize-bun-lockfile.sh)",
|
|
@@ -47,7 +48,7 @@
|
|
|
47
48
|
"@willbooster/oxfmt-config": "1.2.2",
|
|
48
49
|
"@willbooster/oxlint-config": "1.4.8",
|
|
49
50
|
"@willbooster/wb": "22.13.1",
|
|
50
|
-
"@willbooster/web-tree-sitter": "1.
|
|
51
|
+
"@willbooster/web-tree-sitter": "1.4.3",
|
|
51
52
|
"conventional-changelog-conventionalcommits": "10.4.0",
|
|
52
53
|
"lefthook": "2.1.14",
|
|
53
54
|
"oxfmt": "0.70.0",
|
|
@@ -63,7 +64,7 @@
|
|
|
63
64
|
"wrangler": "4.135.0"
|
|
64
65
|
},
|
|
65
66
|
"peerDependencies": {
|
|
66
|
-
"@willbooster/web-tree-sitter": "^1.
|
|
67
|
+
"@willbooster/web-tree-sitter": "^1.3.0"
|
|
67
68
|
},
|
|
68
69
|
"peerDependenciesMeta": {
|
|
69
70
|
"@willbooster/web-tree-sitter": {
|
package/tree-sitter-c_sharp.wasm
CHANGED
|
Binary file
|