@willbooster/tree-sitter-java 3.0.2 → 3.0.4

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
@@ -72,6 +72,7 @@ module.exports = grammar({
72
72
  ],
73
73
 
74
74
  conflicts: $ => [
75
+ [$._literal, $.switch_label],
75
76
  [$.dimensions],
76
77
  [$.array_type, $._unannotated_type],
77
78
  [$.array_type, $.primary_expression],
@@ -101,7 +102,6 @@ module.exports = grammar({
101
102
  $.method_declaration,
102
103
  ),
103
104
 
104
- // Literals
105
105
 
106
106
  _literal: $ => choice(
107
107
  $.decimal_integer_literal,
@@ -226,7 +226,6 @@ module.exports = grammar({
226
226
 
227
227
  null_literal: _ => 'null',
228
228
 
229
- // Expressions
230
229
 
231
230
  expression: $ => choice(
232
231
  $.assignment_expression,
@@ -508,6 +507,7 @@ module.exports = grammar({
508
507
  ),
509
508
 
510
509
  switch_label: $ => choice(
510
+ prec.dynamic(1, seq('case', $.null_literal, ',', 'default')),
511
511
  seq('case',
512
512
  choice(
513
513
  $.pattern,
@@ -538,7 +538,6 @@ module.exports = grammar({
538
538
 
539
539
  guard: $ => seq('when', $.expression),
540
540
 
541
- // Statements
542
541
 
543
542
  statement: $ => choice(
544
543
  $.declaration,
@@ -707,7 +706,6 @@ module.exports = grammar({
707
706
  field('body', $.statement),
708
707
  ),
709
708
 
710
- // Annotations
711
709
 
712
710
  _annotation: $ => choice(
713
711
  $.marker_annotation,
@@ -753,7 +751,6 @@ module.exports = grammar({
753
751
  '}',
754
752
  ),
755
753
 
756
- // Declarations
757
754
 
758
755
  declaration: $ => prec(PREC.DECL, choice(
759
756
  $.module_declaration,
@@ -1134,7 +1131,6 @@ module.exports = grammar({
1134
1131
  '}',
1135
1132
  ),
1136
1133
 
1137
- // Types
1138
1134
 
1139
1135
  _type: $ => choice(
1140
1136
  $._unannotated_type,
@@ -1236,12 +1232,12 @@ module.exports = grammar({
1236
1232
  $._variable_declarator_id,
1237
1233
  ),
1238
1234
 
1239
- receiver_parameter: $ => seq(
1235
+ receiver_parameter: $ => prec.dynamic(1, seq(
1240
1236
  repeat($._annotation),
1241
1237
  $._unannotated_type,
1242
1238
  repeat(seq($.identifier, '.')),
1243
1239
  $.this,
1244
- ),
1240
+ )),
1245
1241
 
1246
1242
  spread_parameter: $ => seq(
1247
1243
  optional($.modifiers),
@@ -1309,8 +1305,6 @@ module.exports = grammar({
1309
1305
  });
1310
1306
 
1311
1307
  /**
1312
- * Creates a rule to match one or more of the rules separated by `separator`
1313
- *
1314
1308
  * @param {RuleOrLiteral} rule
1315
1309
  *
1316
1310
  * @param {RuleOrLiteral} separator
@@ -1322,8 +1316,6 @@ function sep1(rule, separator) {
1322
1316
  }
1323
1317
 
1324
1318
  /**
1325
- * Creates a rule to match one or more of the rules separated by a comma
1326
- *
1327
1319
  * @param {RuleOrLiteral} rule
1328
1320
  *
1329
1321
  * @returns {SeqRule}
@@ -1333,8 +1325,6 @@ function commaSep1(rule) {
1333
1325
  }
1334
1326
 
1335
1327
  /**
1336
- * Creates a rule to optionally match one or more of the rules separated by a comma
1337
- *
1338
1328
  * @param {RuleOrLiteral} rule
1339
1329
  *
1340
1330
  * @returns {ChoiceRule}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@willbooster/tree-sitter-java",
3
- "version": "3.0.2",
3
+ "version": "3.0.4",
4
4
  "description": "Java grammar for tree-sitter",
5
5
  "keywords": [
6
6
  "incremental",
@@ -3596,6 +3596,10 @@
3596
3596
  "type": "guard",
3597
3597
  "named": true
3598
3598
  },
3599
+ {
3600
+ "type": "null_literal",
3601
+ "named": true
3602
+ },
3599
3603
  {
3600
3604
  "type": "pattern",
3601
3605
  "named": true
Binary file
package/tree-sitter.json CHANGED
@@ -14,7 +14,7 @@
14
14
  }
15
15
  ],
16
16
  "metadata": {
17
- "version": "3.0.2",
17
+ "version": "3.0.4",
18
18
  "license": "MIT",
19
19
  "description": "Java grammar for tree-sitter",
20
20
  "authors": [