@willbooster/tree-sitter-java 1.0.0 → 2.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 +11 -8
- package/grammar.js +1 -1
- package/package.json +3 -3
- package/tree-sitter-java.wasm +0 -0
- package/tree-sitter.json +1 -1
package/README.md
CHANGED
|
@@ -1,23 +1,26 @@
|
|
|
1
1
|
# @willbooster/tree-sitter-java
|
|
2
2
|
|
|
3
|
+
[](https://www.npmjs.com/package/@willbooster/tree-sitter-java)
|
|
4
|
+
[](https://www.npmjs.com/package/@willbooster/tree-sitter-java)
|
|
3
5
|
[](https://github.com/WillBooster/tree-sitter-java/actions/workflows/test.yml)
|
|
4
6
|
[](https://github.com/WillBooster/tree-sitter-java/actions/workflows/test-rust.yml)
|
|
5
7
|
[](https://github.com/semantic-release/semantic-release)
|
|
6
|
-
[](https://github.com/WillBooster/shared/tree/main/packages/wbfy)
|
|
7
9
|
[](https://crates.io/crates/willbooster-tree-sitter-java)
|
|
8
10
|
|
|
9
11
|
Java grammar for [tree-sitter](https://github.com/tree-sitter/tree-sitter), forked from
|
|
10
12
|
[tree-sitter/tree-sitter-java](https://github.com/tree-sitter/tree-sitter-java). We are grateful
|
|
11
13
|
to its authors and contributors. This is not an official release of that project.
|
|
12
14
|
|
|
13
|
-
This fork
|
|
14
|
-
|
|
15
|
-
[WillBooster/tree-sitter](https://github.com/WillBooster/tree-sitter) generator emits
|
|
15
|
+
This fork is based on tree-sitter-java 0.23.5 and accepts `final` modifiers on switch type patterns.
|
|
16
|
+
The extension preserves the existing node types. It ships the parser as the compact tables that the
|
|
17
|
+
[WillBooster/tree-sitter](https://github.com/WillBooster/tree-sitter) generator emits under that fork's own ABI number
|
|
18
|
+
(`0x57420001`), so the parser loads only with that runtime, version 2.0.0 or later, and not with upstream's tree-sitter.
|
|
16
19
|
|
|
17
20
|
## Usage
|
|
18
21
|
|
|
19
22
|
The npm package ships `tree-sitter-java.wasm` for
|
|
20
|
-
[@willbooster/web-tree-sitter](https://www.npmjs.com/package/@willbooster/web-tree-sitter) version
|
|
23
|
+
[@willbooster/web-tree-sitter](https://www.npmjs.com/package/@willbooster/web-tree-sitter) version 2.0.0 or later, which runs in Node.js, Bun, browsers, and Cloudflare Workers. In Node.js and Bun, load the grammar from its path:
|
|
21
24
|
|
|
22
25
|
```js
|
|
23
26
|
import { fileURLToPath } from 'node:url';
|
|
@@ -63,8 +66,8 @@ fuzzed with:
|
|
|
63
66
|
|
|
64
67
|
```toml
|
|
65
68
|
[dependencies]
|
|
66
|
-
tree-sitter = { package = "willbooster-tree-sitter", version = "
|
|
67
|
-
tree-sitter-java = { package = "willbooster-tree-sitter-java", version = "
|
|
69
|
+
tree-sitter = { package = "willbooster-tree-sitter", version = "2" }
|
|
70
|
+
tree-sitter-java = { package = "willbooster-tree-sitter-java", version = "2" }
|
|
68
71
|
```
|
|
69
72
|
|
|
70
73
|
```rust
|
|
@@ -93,7 +96,7 @@ well (e.g. `script/tree-sitter parse File.java`).
|
|
|
93
96
|
`grammar.js` stays as upstream wrote and formatted it, apart from rule changes, so that it can be compared with
|
|
94
97
|
upstream's grammar; the linter and the formatter skip it.
|
|
95
98
|
|
|
96
|
-
`bun run generate` records a fresh
|
|
99
|
+
`bun run generate` records a fresh generation profile from the applicable `test/corpus` cases and any Git-tracked
|
|
97
100
|
files in `examples/`, then generates compact parser tables. The parser also embeds metadata from `tree-sitter.json`. After changing a grammar,
|
|
98
101
|
`tree-sitter.json`, a corpus case, a tracked example, or the `willbooster-tree-sitter` version in `Cargo.lock` (whose
|
|
99
102
|
CLI generates the parser),
|
package/grammar.js
CHANGED
|
@@ -519,7 +519,7 @@ module.exports = grammar({
|
|
|
519
519
|
$.type_pattern,
|
|
520
520
|
$.record_pattern,
|
|
521
521
|
),
|
|
522
|
-
type_pattern: $ => seq($._unannotated_type, choice($.identifier, $._reserved_identifier)),
|
|
522
|
+
type_pattern: $ => seq(optional('final'), $._unannotated_type, choice($.identifier, $._reserved_identifier)),
|
|
523
523
|
record_pattern: $ => seq(choice($.identifier, $._reserved_identifier, $.generic_type), $.record_pattern_body),
|
|
524
524
|
record_pattern_body: $ => seq('(', commaSep(choice($.record_pattern_component, $.record_pattern)), ')'),
|
|
525
525
|
record_pattern_component: $ => choice(
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@willbooster/tree-sitter-java",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.1",
|
|
4
4
|
"description": "Java grammar for tree-sitter",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"incremental",
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"@willbooster/oxfmt-config": "1.2.2",
|
|
48
48
|
"@willbooster/oxlint-config": "1.4.8",
|
|
49
49
|
"@willbooster/wb": "22.24.0",
|
|
50
|
-
"@willbooster/web-tree-sitter": "
|
|
50
|
+
"@willbooster/web-tree-sitter": "2.0.1",
|
|
51
51
|
"conventional-changelog-conventionalcommits": "10.4.0",
|
|
52
52
|
"lefthook": "2.1.16",
|
|
53
53
|
"oxfmt": "0.71.0",
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
"wrangler": "4.147.0"
|
|
62
62
|
},
|
|
63
63
|
"peerDependencies": {
|
|
64
|
-
"@willbooster/web-tree-sitter": "^
|
|
64
|
+
"@willbooster/web-tree-sitter": "^2.0.0"
|
|
65
65
|
},
|
|
66
66
|
"peerDependenciesMeta": {
|
|
67
67
|
"@willbooster/web-tree-sitter": {
|
package/tree-sitter-java.wasm
CHANGED
|
Binary file
|