@willbooster/tree-sitter-java 8.0.2 → 9.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 +2 -1
- package/grammar.js +29 -16
- package/package.json +1 -1
- package/src/node-types.json +1 -1
- package/tree-sitter-java.wasm +0 -0
- package/tree-sitter.json +1 -1
package/README.md
CHANGED
|
@@ -19,6 +19,7 @@ pattern variables use `underscore_pattern` nodes. Binding annotations are direct
|
|
|
19
19
|
annotations inside the `right` field's `annotated_type` node.
|
|
20
20
|
|
|
21
21
|
Annotation interface declarations expose separate `@` and `interface` tokens.
|
|
22
|
+
Postfix updates appear inside surrounding cast or unary nodes. An `update_expression` has a primary expression as its operand.
|
|
22
23
|
|
|
23
24
|
The parser ships as compact tables under the [WillBooster/tree-sitter](https://github.com/WillBooster/tree-sitter)
|
|
24
25
|
fork's ABI (`0x57420007`). This package is tested with runtime 9.0.0. Runtimes with a different ABI, including
|
|
@@ -86,7 +87,7 @@ fuzzed with:
|
|
|
86
87
|
```toml
|
|
87
88
|
[dependencies]
|
|
88
89
|
tree-sitter = { package = "willbooster-tree-sitter", version = "9.0.0" }
|
|
89
|
-
tree-sitter-java = { package = "willbooster-tree-sitter-java", version = "
|
|
90
|
+
tree-sitter-java = { package = "willbooster-tree-sitter-java", version = "9" }
|
|
90
91
|
```
|
|
91
92
|
|
|
92
93
|
```rust
|
package/grammar.js
CHANGED
|
@@ -326,7 +326,7 @@ module.exports = grammar({
|
|
|
326
326
|
$.switch_expression,
|
|
327
327
|
),
|
|
328
328
|
|
|
329
|
-
cast_expression: $ => prec(PREC.CAST, choice(
|
|
329
|
+
cast_expression: $ => prec.right(PREC.CAST, choice(
|
|
330
330
|
seq(
|
|
331
331
|
'(',
|
|
332
332
|
field('type', $._type),
|
|
@@ -337,7 +337,14 @@ module.exports = grammar({
|
|
|
337
337
|
'(',
|
|
338
338
|
sep1(field('type', $._type), '&'),
|
|
339
339
|
')',
|
|
340
|
-
field('value', choice(
|
|
340
|
+
field('value', choice(
|
|
341
|
+
$.primary_expression,
|
|
342
|
+
alias($._postfix_update_expression, $.update_expression),
|
|
343
|
+
alias($._unary_complement_expression, $.unary_expression),
|
|
344
|
+
$.cast_expression,
|
|
345
|
+
$.switch_expression,
|
|
346
|
+
$.lambda_expression,
|
|
347
|
+
)),
|
|
341
348
|
),
|
|
342
349
|
)),
|
|
343
350
|
|
|
@@ -419,24 +426,30 @@ module.exports = grammar({
|
|
|
419
426
|
field('alternative', $.expression),
|
|
420
427
|
)),
|
|
421
428
|
|
|
422
|
-
unary_expression: $ => choice(
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
['~', PREC.UNARY],
|
|
427
|
-
].map(([operator, precedence]) =>
|
|
428
|
-
prec.left(precedence, seq(
|
|
429
|
-
// @ts-ignore
|
|
430
|
-
field('operator', operator),
|
|
429
|
+
unary_expression: $ => choice(
|
|
430
|
+
$._unary_complement_expression,
|
|
431
|
+
prec.left(PREC.UNARY, seq(
|
|
432
|
+
field('operator', choice('+', '-')),
|
|
431
433
|
field('operand', $.expression),
|
|
432
434
|
)),
|
|
435
|
+
),
|
|
436
|
+
|
|
437
|
+
_unary_complement_expression: $ => prec.left(PREC.UNARY, seq(
|
|
438
|
+
field('operator', choice('~', '!')),
|
|
439
|
+
field('operand', $.expression),
|
|
433
440
|
)),
|
|
434
441
|
|
|
435
|
-
update_expression: $ =>
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
442
|
+
update_expression: $ => choice(
|
|
443
|
+
$._postfix_update_expression,
|
|
444
|
+
prec.right(PREC.UNARY, choice(
|
|
445
|
+
seq('++', $.primary_expression),
|
|
446
|
+
seq('--', $.primary_expression),
|
|
447
|
+
)),
|
|
448
|
+
),
|
|
449
|
+
|
|
450
|
+
_postfix_update_expression: $ => prec.right(PREC.UNARY, choice(
|
|
451
|
+
seq($.primary_expression, '++'),
|
|
452
|
+
seq($.primary_expression, '--'),
|
|
440
453
|
)),
|
|
441
454
|
|
|
442
455
|
primary_expression: $ => choice(
|
package/package.json
CHANGED
package/src/node-types.json
CHANGED
package/tree-sitter-java.wasm
CHANGED
|
Binary file
|