@willbooster/tree-sitter-kotlin 20.0.0 → 21.0.0
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 +11 -41
- package/package.json +3 -4
- package/tree-sitter-kotlin.wasm +0 -0
- package/tree-sitter.json +1 -1
package/README.md
CHANGED
|
@@ -17,16 +17,16 @@ This fork fixes parsing bugs and raises conformance with the Kotlin grammar.
|
|
|
17
17
|
## Support Scope
|
|
18
18
|
|
|
19
19
|
This fork maintains only full parsing: valid input yields a correct tree, and invalid input yields `ERROR` or `MISSING`
|
|
20
|
-
nodes without crashing, hanging, or taking more than linear time. Incremental parsing
|
|
21
|
-
|
|
22
|
-
|
|
20
|
+
nodes without crashing, hanging, or taking more than linear time. Incremental parsing is not supported, and no queries
|
|
21
|
+
(highlights, locals, injections, tags) are shipped. Node types, field names, and the trees that error recovery produces
|
|
22
|
+
may change; such changes are released as new major versions.
|
|
23
23
|
|
|
24
24
|
## Usage
|
|
25
25
|
|
|
26
26
|
The npm package ships `tree-sitter-kotlin.wasm` for
|
|
27
27
|
[@willbooster/web-tree-sitter](https://www.npmjs.com/package/@willbooster/web-tree-sitter), which runs in Node.js, Bun,
|
|
28
|
-
browsers, and Cloudflare Workers. The supported runtime is `@willbooster/web-tree-sitter` version
|
|
29
|
-
|
|
28
|
+
browsers, and Cloudflare Workers. The supported runtime is `@willbooster/web-tree-sitter` version 20.0.0 or later in the
|
|
29
|
+
20.x series; the upstream Tree-sitter runtime rejects this parser.
|
|
30
30
|
|
|
31
31
|
In Node.js and Bun:
|
|
32
32
|
|
|
@@ -71,10 +71,10 @@ The package also ships the node types in `src/node-types.json`.
|
|
|
71
71
|
|
|
72
72
|
In Rust, depend on the [crate](https://crates.io/crates/willbooster-tree-sitter-kotlin) and on
|
|
73
73
|
[willbooster-tree-sitter](https://crates.io/crates/willbooster-tree-sitter), the runtime with the matching ABI that this
|
|
74
|
-
package is tested and fuzzed with. Use version
|
|
74
|
+
package is tested and fuzzed with. Use version 20.0.0 or later in the 20.x series:
|
|
75
75
|
|
|
76
76
|
```sh
|
|
77
|
-
cargo add willbooster-tree-sitter@
|
|
77
|
+
cargo add willbooster-tree-sitter@20.0.0 --rename tree-sitter
|
|
78
78
|
cargo add willbooster-tree-sitter-kotlin --rename tree-sitter-kotlin
|
|
79
79
|
```
|
|
80
80
|
|
|
@@ -90,44 +90,14 @@ mise install
|
|
|
90
90
|
bun install --frozen-lockfile
|
|
91
91
|
bun run test/ci-setup
|
|
92
92
|
bun run build/ci
|
|
93
|
+
bun run verify
|
|
93
94
|
bun run test
|
|
94
|
-
script/parse-examples
|
|
95
95
|
cargo test
|
|
96
96
|
```
|
|
97
97
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
`script/
|
|
101
|
-
the download fails or the release has no binary that runs here.
|
|
102
|
-
|
|
103
|
-
`bun run generate` records a fresh generation profile from the applicable `test/corpus` cases and Git-tracked
|
|
104
|
-
files in `examples/`, then generates compact parser tables. The parser also embeds metadata from `tree-sitter.json`. After changing a grammar,
|
|
105
|
-
`tree-sitter.json`, a corpus case, or a tracked example,
|
|
106
|
-
regenerate and commit `src/`. Stage added or removed examples with `git add -A examples` before generation so the profile uses the intended file list.
|
|
107
|
-
Profiles in `.tmp/generation-profiles/` are temporary and must not be committed. `bun run build-wasm`, `bun run build/ci`,
|
|
108
|
-
and the release build regenerate the parsers before compiling them.
|
|
109
|
-
|
|
110
|
-
`bun run test` runs:
|
|
111
|
-
|
|
112
|
-
- the corpus in `test/corpus`, with the native build and with the Wasm build (the first run downloads the WASI SDK);
|
|
113
|
-
- a check that real-world Kotlin files cloned into `examples/` fail to parse exactly as listed in
|
|
114
|
-
`script/known-failures.txt`. The first run clones them. The example repositories are pinned to commits in
|
|
115
|
-
`script/parse-examples`. After a grammar change or a moved pin alters that list, `script/parse-examples` rewrites
|
|
116
|
-
it; review its diff before committing;
|
|
117
|
-
- a performance check (`test/unit/performance.test.ts`) that recovering from an error on each line takes linear time
|
|
118
|
-
(ten times the lines take about ten times the CPU time, under a ceiling), since consumers parse files while they are
|
|
119
|
-
being edited. It loads the Wasm build through @willbooster/web-tree-sitter, which `bun run build/ci` rebuilds after
|
|
120
|
-
regenerating the parser;
|
|
121
|
-
- a check that `package.json` and `Cargo.lock` test the same runtime version (`test/unit/runtimeVersion.test.ts`);
|
|
122
|
-
- checks that the Wasm build parses Kotlin through @willbooster/web-tree-sitter in Chromium
|
|
123
|
-
(`test/unit/browser.test.ts`) and in Cloudflare Workers with and without Node.js compatibility
|
|
124
|
-
(`test/unit/workers.test.ts`).
|
|
125
|
-
|
|
126
|
-
The tests and `script/parse-examples` compile the parser into `.tmp/tree-sitter-lib` rather than the CLI's cache shared
|
|
127
|
-
by every checkout, and `mise.toml` sets `TREE_SITTER_LIBDIR` to it for any other command run in the checkout.
|
|
128
|
-
|
|
129
|
-
CI also runs these tests on Linux arm64 and macOS, where the Rust binding compiles the parser natively, and fuzzes the
|
|
130
|
-
parser with libFuzzer and sanitizers (`.github/workflows/robustness.yml`).
|
|
98
|
+
- `script/tree-sitter` runs the `WillBooster/tree-sitter` CLI locked in `Cargo.lock` (`script/runtime-version`). Keep `@willbooster/web-tree-sitter` in `package.json` and `willbooster-tree-sitter` in `Cargo.lock` at the same version.
|
|
99
|
+
- Run `bun run build-wasm` and commit `src/` after changing `grammar.js`, `tree-sitter.json`, `test/corpus/`, or Git-tracked `examples/`. Stage added or removed files under `examples/` with `git add -A examples` before regenerating.
|
|
100
|
+
- Run `script/parse-examples` to update `script/known-failures.txt` after a grammar change or a pin update in `script/parse-examples` alters which pinned examples fail to parse.
|
|
131
101
|
|
|
132
102
|
### References
|
|
133
103
|
|
package/package.json
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@willbooster/tree-sitter-kotlin",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "21.0.0",
|
|
4
4
|
"description": "Kotlin grammar for tree-sitter",
|
|
5
5
|
"keywords": [
|
|
6
|
-
"incremental",
|
|
7
6
|
"kotlin",
|
|
8
7
|
"parsing",
|
|
9
8
|
"tree-sitter"
|
|
@@ -49,7 +48,7 @@
|
|
|
49
48
|
"@vitest/browser-playwright": "5.0.5",
|
|
50
49
|
"@willbooster/oxlint-config": "1.4.9",
|
|
51
50
|
"@willbooster/wb": "23.3.0",
|
|
52
|
-
"@willbooster/web-tree-sitter": "
|
|
51
|
+
"@willbooster/web-tree-sitter": "20.0.0",
|
|
53
52
|
"conventional-changelog-conventionalcommits": "10.4.1",
|
|
54
53
|
"lefthook": "2.2.2",
|
|
55
54
|
"oxlint": "1.90.0",
|
|
@@ -61,7 +60,7 @@
|
|
|
61
60
|
"wrangler": "4.156.0"
|
|
62
61
|
},
|
|
63
62
|
"peerDependencies": {
|
|
64
|
-
"@willbooster/web-tree-sitter": "^
|
|
63
|
+
"@willbooster/web-tree-sitter": "^20.0.0"
|
|
65
64
|
},
|
|
66
65
|
"peerDependenciesMeta": {
|
|
67
66
|
"@willbooster/web-tree-sitter": {
|
package/tree-sitter-kotlin.wasm
CHANGED
|
Binary file
|