@willbooster/tree-sitter-java 6.0.2 → 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
  )),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@willbooster/tree-sitter-java",
3
- "version": "6.0.2",
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
  {
Binary file
package/tree-sitter.json CHANGED
@@ -14,7 +14,7 @@
14
14
  }
15
15
  ],
16
16
  "metadata": {
17
- "version": "6.0.2",
17
+ "version": "7.0.0",
18
18
  "license": "MIT",
19
19
  "description": "Java grammar for tree-sitter",
20
20
  "authors": [