@willbooster/tree-sitter-java 8.0.2 → 8.0.3

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/grammar.js CHANGED
@@ -337,7 +337,13 @@ module.exports = grammar({
337
337
  '(',
338
338
  sep1(field('type', $._type), '&'),
339
339
  ')',
340
- field('value', choice($.primary_expression, $.lambda_expression)),
340
+ field('value', choice(
341
+ $.primary_expression,
342
+ alias($._unary_complement_expression, $.unary_expression),
343
+ $.cast_expression,
344
+ $.switch_expression,
345
+ $.lambda_expression,
346
+ )),
341
347
  ),
342
348
  )),
343
349
 
@@ -419,17 +425,17 @@ module.exports = grammar({
419
425
  field('alternative', $.expression),
420
426
  )),
421
427
 
422
- unary_expression: $ => choice(...[
423
- ['+', PREC.UNARY],
424
- ['-', PREC.UNARY],
425
- ['!', PREC.UNARY],
426
- ['~', PREC.UNARY],
427
- ].map(([operator, precedence]) =>
428
- prec.left(precedence, seq(
429
- // @ts-ignore
430
- field('operator', operator),
428
+ unary_expression: $ => choice(
429
+ $._unary_complement_expression,
430
+ prec.left(PREC.UNARY, seq(
431
+ field('operator', choice('+', '-')),
431
432
  field('operand', $.expression),
432
433
  )),
434
+ ),
435
+
436
+ _unary_complement_expression: $ => prec.left(PREC.UNARY, seq(
437
+ field('operator', choice('~', '!')),
438
+ field('operand', $.expression),
433
439
  )),
434
440
 
435
441
  update_expression: $ => prec.left(PREC.UNARY, choice(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@willbooster/tree-sitter-java",
3
- "version": "8.0.2",
3
+ "version": "8.0.3",
4
4
  "description": "Java grammar for tree-sitter",
5
5
  "keywords": [
6
6
  "incremental",
Binary file
package/tree-sitter.json CHANGED
@@ -14,7 +14,7 @@
14
14
  }
15
15
  ],
16
16
  "metadata": {
17
- "version": "8.0.2",
17
+ "version": "8.0.3",
18
18
  "license": "MIT",
19
19
  "description": "Java grammar for tree-sitter",
20
20
  "authors": [