@willbooster/tree-sitter-java 8.0.1 → 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
 
@@ -347,6 +353,7 @@ module.exports = grammar({
347
353
  $._reserved_identifier,
348
354
  $.field_access,
349
355
  $.array_access,
356
+ $.parenthesized_expression,
350
357
  )),
351
358
  field('operator', choice('=', '+=', '-=', '*=', '/=', '&=', '|=', '^=', '%=', '<<=', '>>=', '>>>=')),
352
359
  field('right', $.expression),
@@ -418,17 +425,17 @@ module.exports = grammar({
418
425
  field('alternative', $.expression),
419
426
  )),
420
427
 
421
- unary_expression: $ => choice(...[
422
- ['+', PREC.UNARY],
423
- ['-', PREC.UNARY],
424
- ['!', PREC.UNARY],
425
- ['~', PREC.UNARY],
426
- ].map(([operator, precedence]) =>
427
- prec.left(precedence, seq(
428
- // @ts-ignore
429
- field('operator', operator),
428
+ unary_expression: $ => choice(
429
+ $._unary_complement_expression,
430
+ prec.left(PREC.UNARY, seq(
431
+ field('operator', choice('+', '-')),
430
432
  field('operand', $.expression),
431
433
  )),
434
+ ),
435
+
436
+ _unary_complement_expression: $ => prec.left(PREC.UNARY, seq(
437
+ field('operator', choice('~', '!')),
438
+ field('operand', $.expression),
432
439
  )),
433
440
 
434
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.1",
3
+ "version": "8.0.3",
4
4
  "description": "Java grammar for tree-sitter",
5
5
  "keywords": [
6
6
  "incremental",
@@ -804,6 +804,10 @@
804
804
  {
805
805
  "type": "identifier",
806
806
  "named": true
807
+ },
808
+ {
809
+ "type": "parenthesized_expression",
810
+ "named": true
807
811
  }
808
812
  ]
809
813
  },
Binary file
package/tree-sitter.json CHANGED
@@ -14,7 +14,7 @@
14
14
  }
15
15
  ],
16
16
  "metadata": {
17
- "version": "8.0.1",
17
+ "version": "8.0.3",
18
18
  "license": "MIT",
19
19
  "description": "Java grammar for tree-sitter",
20
20
  "authors": [