@willbooster/tree-sitter-java 6.0.1 → 7.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 CHANGED
@@ -12,12 +12,15 @@ Java grammar for [tree-sitter](https://github.com/tree-sitter/tree-sitter), fork
12
12
  [tree-sitter/tree-sitter-java](https://github.com/tree-sitter/tree-sitter-java). We are grateful
13
13
  to its authors and contributors. This is not an official release of that project.
14
14
 
15
- This fork is based on tree-sitter-java 0.23.5 and accepts `final` modifiers on switch type patterns
16
- and typed record-pattern components, plus qualified names in record patterns. Unnamed variables in switch and
17
- `instanceof` type patterns, including typed record-pattern components, use `underscore_pattern` nodes. It ships the
18
- parser as the compact tables that the [WillBooster/tree-sitter](https://github.com/WillBooster/tree-sitter) generator
19
- emits under that fork's own ABI number (`0x57420007`), so the parser loads only with that runtime, version 9.0.0 or
20
- later within major version 9, and not with upstream's tree-sitter.
15
+ This fork is based on tree-sitter-java 0.23.5 and accepts annotation and `final` modifiers on switch and
16
+ `instanceof` type patterns and typed record-pattern components, plus qualified names in record patterns. Unnamed
17
+ pattern variables use `underscore_pattern` nodes. Binding annotations are direct children of `type_pattern`,
18
+ `instanceof_expression`, or `record_pattern_component`; an `instanceof` type test without a binding keeps its
19
+ annotations inside the `right` field's `annotated_type` node.
20
+
21
+ The parser ships as compact tables under the [WillBooster/tree-sitter](https://github.com/WillBooster/tree-sitter)
22
+ fork's ABI (`0x57420007`). This package is tested with runtime 9.0.0. Runtimes with a different ABI, including
23
+ upstream's tree-sitter, reject the parser.
21
24
 
22
25
  ## Usage
23
26
 
@@ -81,7 +84,7 @@ fuzzed with:
81
84
  ```toml
82
85
  [dependencies]
83
86
  tree-sitter = { package = "willbooster-tree-sitter", version = "9.0.0" }
84
- tree-sitter-java = { package = "willbooster-tree-sitter-java", version = "6" }
87
+ tree-sitter-java = { package = "willbooster-tree-sitter-java", version = "7" }
85
88
  ```
86
89
 
87
90
  ```rust
package/grammar.js CHANGED
@@ -73,7 +73,7 @@ module.exports = grammar({
73
73
  [$.array_type, $._unannotated_type],
74
74
  [$.array_type, $.primary_expression],
75
75
  [$.modifiers, $.annotated_type, $.receiver_parameter],
76
- [$.type_pattern, $.annotated_type],
76
+ [$.instanceof_expression, $.annotated_type],
77
77
  [$.modifiers, $.annotated_type, $.module_declaration, $.package_declaration],
78
78
  [$._unannotated_type, $.primary_expression, $.inferred_parameters],
79
79
  [$._unannotated_type, $.primary_expression],
@@ -384,12 +384,13 @@ module.exports = grammar({
384
384
  instanceof_expression: $ => prec(PREC.REL, seq(
385
385
  field('left', $.expression),
386
386
  'instanceof',
387
- optional('final'),
388
387
  choice(
389
388
  seq(
390
- field('right', $._type),
391
- optional(field('name', choice($.identifier, $._reserved_identifier, $.underscore_pattern))),
389
+ repeat(choice($._annotation, 'final')),
390
+ field('right', $._unannotated_type),
391
+ field('name', choice($.identifier, $._reserved_identifier, $.underscore_pattern)),
392
392
  ),
393
+ field('right', $._type),
393
394
  field('pattern', $.record_pattern),
394
395
  ),
395
396
  )),
@@ -620,7 +621,7 @@ module.exports = grammar({
620
621
  record_pattern_component: $ => choice(
621
622
  $.underscore_pattern,
622
623
  seq(
623
- optional('final'),
624
+ repeat(choice($._annotation, 'final')),
624
625
  $._unannotated_type,
625
626
  choice($.identifier, $._reserved_identifier, $.underscore_pattern),
626
627
  ),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@willbooster/tree-sitter-java",
3
- "version": "6.0.1",
3
+ "version": "7.0.0",
4
4
  "description": "Java grammar for tree-sitter",
5
5
  "keywords": [
6
6
  "incremental",
@@ -2305,6 +2305,20 @@
2305
2305
  }
2306
2306
  ]
2307
2307
  }
2308
+ },
2309
+ "children": {
2310
+ "multiple": true,
2311
+ "required": false,
2312
+ "types": [
2313
+ {
2314
+ "type": "annotation",
2315
+ "named": true
2316
+ },
2317
+ {
2318
+ "type": "marker_annotation",
2319
+ "named": true
2320
+ }
2321
+ ]
2308
2322
  }
2309
2323
  },
2310
2324
  {
@@ -3218,10 +3232,18 @@
3218
3232
  "type": "_unannotated_type",
3219
3233
  "named": true
3220
3234
  },
3235
+ {
3236
+ "type": "annotation",
3237
+ "named": true
3238
+ },
3221
3239
  {
3222
3240
  "type": "identifier",
3223
3241
  "named": true
3224
3242
  },
3243
+ {
3244
+ "type": "marker_annotation",
3245
+ "named": true
3246
+ },
3225
3247
  {
3226
3248
  "type": "underscore_pattern",
3227
3249
  "named": true
Binary file
package/tree-sitter.json CHANGED
@@ -14,7 +14,7 @@
14
14
  }
15
15
  ],
16
16
  "metadata": {
17
- "version": "6.0.1",
17
+ "version": "7.0.0",
18
18
  "license": "MIT",
19
19
  "description": "Java grammar for tree-sitter",
20
20
  "authors": [