@willbooster/tree-sitter-ruby 15.0.1 → 16.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 +12 -38
- package/package.json +3 -3
- package/tree-sitter-ruby.wasm +0 -0
- package/tree-sitter.json +1 -1
package/README.md
CHANGED
|
@@ -14,8 +14,9 @@ to its authors and contributors. This is not an official release of that project
|
|
|
14
14
|
|
|
15
15
|
This fork extends the upstream grammar to parse anonymous block forwarding, spaced block arguments, and command calls in endless methods, with a parser generated by
|
|
16
16
|
[WillBooster/tree-sitter](https://github.com/WillBooster/tree-sitter), whose compact parse tables make the
|
|
17
|
-
parser smaller. The parser carries that fork's own ABI number (`0x5742000c`)
|
|
18
|
-
runtime
|
|
17
|
+
parser smaller. The parser carries that fork's own ABI number (`0x5742000c`) and omits tables dropped in runtime 19, so it
|
|
18
|
+
requires the WillBooster runtime 19.x; upstream's tree-sitter runtime and incompatible ABI versions of the fork's runtime
|
|
19
|
+
reject it.
|
|
19
20
|
The scanner preserves long heredoc identifiers
|
|
20
21
|
when their state fits the runtime's serialization buffer. If the open heredocs cannot fit, their bodies are parsed as
|
|
21
22
|
code instead of aborting the process.
|
|
@@ -31,7 +32,7 @@ the trees that error recovery produces may change; such changes are released as
|
|
|
31
32
|
|
|
32
33
|
The npm package ships `tree-sitter-ruby.wasm` for
|
|
33
34
|
[@willbooster/web-tree-sitter](https://www.npmjs.com/package/@willbooster/web-tree-sitter), which runs in Node.js, Bun,
|
|
34
|
-
browsers, and Cloudflare Workers. The parser requires runtime
|
|
35
|
+
browsers, and Cloudflare Workers. The parser requires runtime 19.x.
|
|
35
36
|
|
|
36
37
|
In Node.js and Bun, load the grammar from its path:
|
|
37
38
|
|
|
@@ -75,10 +76,10 @@ The package also ships the node types in `src/node-types.json`.
|
|
|
75
76
|
|
|
76
77
|
In Rust, depend on the [crate](https://crates.io/crates/willbooster-tree-sitter-ruby) and on
|
|
77
78
|
[willbooster-tree-sitter](https://crates.io/crates/willbooster-tree-sitter), the runtime this package is tested and
|
|
78
|
-
fuzzed with. The parser requires runtime
|
|
79
|
+
fuzzed with. The parser requires runtime 19.x:
|
|
79
80
|
|
|
80
81
|
```sh
|
|
81
|
-
cargo add willbooster-tree-sitter@
|
|
82
|
+
cargo add willbooster-tree-sitter@19.1.1 --rename tree-sitter
|
|
82
83
|
cargo add willbooster-tree-sitter-ruby --rename tree-sitter-ruby
|
|
83
84
|
```
|
|
84
85
|
|
|
@@ -92,44 +93,17 @@ parser.set_language(&tree_sitter_ruby::LANGUAGE.into())?;
|
|
|
92
93
|
```sh
|
|
93
94
|
mise install
|
|
94
95
|
bun install --frozen-lockfile
|
|
96
|
+
bun run test/ci-setup
|
|
95
97
|
bun run build/ci
|
|
98
|
+
bun run verify
|
|
96
99
|
bun run test
|
|
97
|
-
script/parse-examples
|
|
98
100
|
cargo test
|
|
99
101
|
```
|
|
100
102
|
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
that runs here. Run other CLI commands through it as well (e.g. `script/tree-sitter parse file.rb`).
|
|
106
|
-
|
|
107
|
-
`bun run generate` records a fresh generation profile from the applicable `test/corpus` cases and Git-tracked
|
|
108
|
-
files in `examples/`, then generates compact parser tables. The parser also embeds metadata from `tree-sitter.json`.
|
|
109
|
-
After changing the grammar, `tree-sitter.json`, a corpus case, or a tracked example, regenerate and commit `src/`. Stage
|
|
110
|
-
added or removed examples with `git add -A examples` before generation so the profile uses the intended file list.
|
|
111
|
-
Profiles in `.tmp/generation-profiles/` are temporary and must not be committed. `bun run build-wasm`,
|
|
112
|
-
`bun run build/ci`, and the release build regenerate the parser before compiling it.
|
|
113
|
-
|
|
114
|
-
`bun run test` runs:
|
|
115
|
-
|
|
116
|
-
- the corpus in `test/corpus`, with the native build and with the Wasm build (the first run downloads the WASI SDK);
|
|
117
|
-
- included-range comment checks (`test/unit/includedRanges.test.ts`), which load the Wasm build produced by
|
|
118
|
-
`bun run build/ci`;
|
|
119
|
-
- a check that the real-world Ruby files of [ruby/spec](https://github.com/ruby/spec) cloned into `examples/` fail to
|
|
120
|
-
parse exactly as listed in `script/known-failures.txt`. The first run clones the repository, which is pinned to a
|
|
121
|
-
commit in `script/parse-examples`. After a grammar change or a moved pin alters that list, `script/parse-examples`
|
|
122
|
-
rewrites it; review its diff before committing;
|
|
123
|
-
- bounded CPU-growth checks for error recovery and comment chains (`test/unit/performance.test.ts`);
|
|
124
|
-
- a check that `package.json` and `Cargo.lock` test the same runtime version (`test/unit/runtimeVersion.test.ts`);
|
|
125
|
-
- checks that the Wasm build parses in Chromium (`test/unit/browser/`) and in Cloudflare Workers with and without
|
|
126
|
-
Node.js compatibility (`test/unit/workerd.test.ts`). Run `bun run test/ci-setup` once to install Chromium.
|
|
127
|
-
|
|
128
|
-
The tests and `script/parse-examples` compile the parser into `.tmp/tree-sitter-lib` rather than the CLI's cache shared
|
|
129
|
-
by every checkout.
|
|
130
|
-
|
|
131
|
-
CI also runs these tests on Linux arm64 and macOS, where the Rust binding compiles the parser natively, and fuzzes the
|
|
132
|
-
parser with libFuzzer and sanitizers (`.github/workflows/robustness.yml`).
|
|
103
|
+
- `bun run test/ci-setup`: run once to install Chromium before `bun run test`.
|
|
104
|
+
- `bun run build/ci`: run before `bun run test`, and commit `src/` after changing `grammar.js`, `tree-sitter.json`, `test/corpus/`, or tracked files in `examples/`. Stage added or removed `examples/` files with `git add -A examples` before generating so the profile sees them.
|
|
105
|
+
- `script/parse-examples`: run without arguments to update `script/known-failures.txt` after a grammar or pin change alters which `ruby/spec` files fail to parse.
|
|
106
|
+
- `script/tree-sitter`: use for direct CLI commands such as `script/tree-sitter parse file.rb` so they run the `WillBooster/tree-sitter` version locked in `Cargo.lock`.
|
|
133
107
|
|
|
134
108
|
### References
|
|
135
109
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@willbooster/tree-sitter-ruby",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "16.0.0",
|
|
4
4
|
"description": "Ruby grammar for tree-sitter",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"incremental",
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
"@vitest/browser-playwright": "5.0.5",
|
|
50
50
|
"@willbooster/oxlint-config": "1.4.9",
|
|
51
51
|
"@willbooster/wb": "23.3.0",
|
|
52
|
-
"@willbooster/web-tree-sitter": "
|
|
52
|
+
"@willbooster/web-tree-sitter": "19.1.1",
|
|
53
53
|
"conventional-changelog-conventionalcommits": "10.4.1",
|
|
54
54
|
"lefthook": "2.2.2",
|
|
55
55
|
"oxlint": "1.90.0",
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
"wrangler": "4.156.0"
|
|
62
62
|
},
|
|
63
63
|
"peerDependencies": {
|
|
64
|
-
"@willbooster/web-tree-sitter": "^
|
|
64
|
+
"@willbooster/web-tree-sitter": "^19.1.1"
|
|
65
65
|
},
|
|
66
66
|
"peerDependenciesMeta": {
|
|
67
67
|
"@willbooster/web-tree-sitter": {
|
package/tree-sitter-ruby.wasm
CHANGED
|
Binary file
|