@willbooster/tree-sitter-rust 1.1.6 → 1.1.7

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 CHANGED
@@ -5,7 +5,7 @@
5
5
  [![Test](https://github.com/WillBooster/tree-sitter-rust/actions/workflows/test.yml/badge.svg)](https://github.com/WillBooster/tree-sitter-rust/actions/workflows/test.yml)
6
6
  [![Test rust](https://github.com/WillBooster/tree-sitter-rust/actions/workflows/test-rust.yml/badge.svg)](https://github.com/WillBooster/tree-sitter-rust/actions/workflows/test-rust.yml)
7
7
  [![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release)
8
- [![wbfy](https://img.shields.io/badge/wbfy-20.28.6-1e90ff.svg)](https://github.com/WillBooster/shared/tree/main/packages/wbfy)
8
+ [![wbfy](https://img.shields.io/badge/wbfy-20.28.7-1e90ff.svg)](https://github.com/WillBooster/shared/tree/main/packages/wbfy)
9
9
  [![crates.io](https://img.shields.io/crates/v/willbooster-tree-sitter-rust.svg)](https://crates.io/crates/willbooster-tree-sitter-rust)
10
10
 
11
11
  Rust grammar for [tree-sitter](https://github.com/tree-sitter/tree-sitter), forked from
@@ -86,12 +86,18 @@ script/parse-examples
86
86
  cargo test
87
87
  ```
88
88
 
89
+ The scripts and tests generate, build, test, and parse with `script/tree-sitter`, the tree-sitter CLI of the
90
+ WillBooster/tree-sitter runtime version locked in `Cargo.lock`, since the generator and the runtime of upstream's CLI are
91
+ not the ones this package ships with. Its first run downloads that CLI from the runtime's GitHub Release, or builds it
92
+ with `cargo` (which needs CMake) when the download fails or the release has no binary that runs here. Run other CLI
93
+ commands through it as well (e.g. `script/tree-sitter parse file.rs`).
94
+
89
95
  `bun run test` runs:
90
96
 
91
97
  - the corpus in `test/corpus`, with the native build and with the Wasm build (the first run downloads the WASI SDK);
92
- - an incremental-parsing check (`test/unit/incremental.test.ts`): `tree-sitter fuzz` edits each corpus case at random,
93
- reparses it, undoes the edits, and reparses again. `TREE_SITTER_SEED`, `TREE_SITTER_ITERATIONS`, and
94
- `TREE_SITTER_EDITS` run other or more edits;
98
+ - an incremental-parsing check (`test/unit/incremental.test.ts`): `script/fuzz-corpus` runs `tree-sitter fuzz`, which
99
+ edits each corpus case at random, reparses it, undoes the edits, and reparses again. `TREE_SITTER_SEED`,
100
+ `TREE_SITTER_ITERATIONS`, and `TREE_SITTER_EDITS` run other or more edits;
95
101
  - a check that the real-world Rust files in `examples/`, the checked-in ones and those of the cloned repositories,
96
102
  fail to parse exactly as listed in `script/known-failures.txt`. The first run clones the repositories. The example
97
103
  repositories are pinned to commits in `script/parse-examples`. After a grammar change or a moved pin alters that list,
@@ -105,7 +111,7 @@ cargo test
105
111
  Node.js compatibility (`test/unit/workerd.test.ts`). Run `bun run test/ci-setup` once to install Chromium.
106
112
 
107
113
  The tests and `script/parse-examples` compile the parser into `.tmp/tree-sitter-lib` rather than the CLI's cache shared
108
- by every checkout.
114
+ by every checkout; `script/fuzz-corpus` builds a per-run parser in `.tmp/fuzz` and deletes it afterwards.
109
115
 
110
116
  CI also runs these tests on Linux arm64 and macOS, where the Rust binding compiles the parser natively, and fuzzes the
111
117
  parser with libFuzzer and sanitizers (`.github/workflows/robustness.yml`).
package/grammar.js CHANGED
@@ -6,9 +6,6 @@
6
6
  * @license MIT
7
7
  */
8
8
 
9
- /// <reference types="tree-sitter-cli/dsl" />
10
- // @ts-check
11
-
12
9
  // https://doc.rust-lang.org/reference/expressions.html#expression-precedence
13
10
  const PREC = {
14
11
  call: 15,
@@ -117,7 +114,7 @@ module.exports = grammar({
117
114
  $._error_sentinel,
118
115
  ],
119
116
 
120
- supertypes: ($) => [$._expression, $._type, $._literal, $._literal_pattern, $._declaration_statement, $._pattern],
117
+ supertypes: ($) => [$._expression, $._type, $._literal, $._literal_pattern, $._pattern],
121
118
 
122
119
  inline: ($) => [
123
120
  $._path,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@willbooster/tree-sitter-rust",
3
- "version": "1.1.6",
3
+ "version": "1.1.7",
4
4
  "description": "Rust grammar for tree-sitter",
5
5
  "keywords": [
6
6
  "incremental",
@@ -22,8 +22,8 @@
22
22
  "*.wasm"
23
23
  ],
24
24
  "scripts": {
25
- "build-wasm": "tree-sitter build --wasm",
26
- "build/ci": "tree-sitter generate && tree-sitter build --wasm",
25
+ "build-wasm": "script/tree-sitter build --wasm",
26
+ "build/ci": "script/tree-sitter generate && script/tree-sitter build --wasm",
27
27
  "cleanup": "bun wb lint --fix --format",
28
28
  "format": "bun wb lint --format",
29
29
  "lint": "bun wb lint",
@@ -31,7 +31,7 @@
31
31
  "prepare": "(bun lefthook install || true) && (test ! -f .lefthook/normalize-bun-lockfile.sh || bash .lefthook/normalize-bun-lockfile.sh)",
32
32
  "release": "wb release",
33
33
  "prestart": "bun run build-wasm",
34
- "start": "tree-sitter playground",
34
+ "start": "script/tree-sitter playground",
35
35
  "test": "bun wb test",
36
36
  "test/ci": "bun wb test-on-ci",
37
37
  "test/ci-setup": "playwright install chromium",
@@ -46,7 +46,7 @@
46
46
  "@willbooster/oxfmt-config": "1.2.2",
47
47
  "@willbooster/oxlint-config": "1.4.8",
48
48
  "@willbooster/wb": "22.13.1",
49
- "@willbooster/web-tree-sitter": "1.0.12",
49
+ "@willbooster/web-tree-sitter": "1.0.15",
50
50
  "conventional-changelog-conventionalcommits": "10.4.0",
51
51
  "lefthook": "2.1.14",
52
52
  "oxfmt": "0.70.0",
@@ -55,7 +55,6 @@
55
55
  "playwright": "1.63.0",
56
56
  "semantic-release": "25.0.9",
57
57
  "sort-package-json": "4.0.0",
58
- "tree-sitter-cli": "0.27.0",
59
58
  "typescript": "7.0.2",
60
59
  "vite": "8.3.0",
61
60
  "vitest": "5.0.1",
Binary file
package/tree-sitter.json CHANGED
@@ -22,7 +22,7 @@
22
22
  }
23
23
  ],
24
24
  "metadata": {
25
- "version": "1.1.6",
25
+ "version": "1.1.7",
26
26
  "license": "MIT",
27
27
  "description": "Rust grammar for tree-sitter",
28
28
  "authors": [