@willbooster/tree-sitter-java 3.0.3 → 3.1.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/grammar.js CHANGED
@@ -102,8 +102,6 @@ module.exports = grammar({
102
102
  $.method_declaration,
103
103
  ),
104
104
 
105
- // Literals
106
-
107
105
  _literal: $ => choice(
108
106
  $.decimal_integer_literal,
109
107
  $.hex_integer_literal,
@@ -227,8 +225,6 @@ module.exports = grammar({
227
225
 
228
226
  null_literal: _ => 'null',
229
227
 
230
- // Expressions
231
-
232
228
  expression: $ => choice(
233
229
  $.assignment_expression,
234
230
  $.binary_expression,
@@ -540,8 +536,6 @@ module.exports = grammar({
540
536
 
541
537
  guard: $ => seq('when', $.expression),
542
538
 
543
- // Statements
544
-
545
539
  statement: $ => choice(
546
540
  $.declaration,
547
541
  $.expression_statement,
@@ -709,8 +703,6 @@ module.exports = grammar({
709
703
  field('body', $.statement),
710
704
  ),
711
705
 
712
- // Annotations
713
-
714
706
  _annotation: $ => choice(
715
707
  $.marker_annotation,
716
708
  $.annotation,
@@ -755,8 +747,6 @@ module.exports = grammar({
755
747
  '}',
756
748
  ),
757
749
 
758
- // Declarations
759
-
760
750
  declaration: $ => prec(PREC.DECL, choice(
761
751
  $.module_declaration,
762
752
  $.package_declaration,
@@ -848,9 +838,10 @@ module.exports = grammar({
848
838
 
849
839
  import_declaration: $ => seq(
850
840
  'import',
851
- optional('static'),
852
- $._name,
853
- optional(seq('.', $.asterisk)),
841
+ choice(
842
+ seq('module', $._name),
843
+ seq(optional('static'), $._name, optional(seq('.', $.asterisk))),
844
+ ),
854
845
  ';',
855
846
  ),
856
847
 
@@ -986,8 +977,8 @@ module.exports = grammar({
986
977
 
987
978
  constructor_body: $ => seq(
988
979
  '{',
989
- optional($.explicit_constructor_invocation),
990
980
  repeat($.statement),
981
+ optional(seq($.explicit_constructor_invocation, repeat($.statement))),
991
982
  '}',
992
983
  ),
993
984
 
@@ -1136,8 +1127,6 @@ module.exports = grammar({
1136
1127
  '}',
1137
1128
  ),
1138
1129
 
1139
- // Types
1140
-
1141
1130
  _type: $ => choice(
1142
1131
  $._unannotated_type,
1143
1132
  $.annotated_type,
@@ -1238,12 +1227,12 @@ module.exports = grammar({
1238
1227
  $._variable_declarator_id,
1239
1228
  ),
1240
1229
 
1241
- receiver_parameter: $ => seq(
1230
+ receiver_parameter: $ => prec.dynamic(1, seq(
1242
1231
  repeat($._annotation),
1243
1232
  $._unannotated_type,
1244
1233
  repeat(seq($.identifier, '.')),
1245
1234
  $.this,
1246
- ),
1235
+ )),
1247
1236
 
1248
1237
  spread_parameter: $ => seq(
1249
1238
  optional($.modifiers),
@@ -1311,8 +1300,6 @@ module.exports = grammar({
1311
1300
  });
1312
1301
 
1313
1302
  /**
1314
- * Creates a rule to match one or more of the rules separated by `separator`
1315
- *
1316
1303
  * @param {RuleOrLiteral} rule
1317
1304
  *
1318
1305
  * @param {RuleOrLiteral} separator
@@ -1324,8 +1311,6 @@ function sep1(rule, separator) {
1324
1311
  }
1325
1312
 
1326
1313
  /**
1327
- * Creates a rule to match one or more of the rules separated by a comma
1328
- *
1329
1314
  * @param {RuleOrLiteral} rule
1330
1315
  *
1331
1316
  * @returns {SeqRule}
@@ -1335,8 +1320,6 @@ function commaSep1(rule) {
1335
1320
  }
1336
1321
 
1337
1322
  /**
1338
- * Creates a rule to optionally match one or more of the rules separated by a comma
1339
- *
1340
1323
  * @param {RuleOrLiteral} rule
1341
1324
  *
1342
1325
  * @returns {ChoiceRule}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@willbooster/tree-sitter-java",
3
- "version": "3.0.3",
3
+ "version": "3.1.0",
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": "3.0.3",
17
+ "version": "3.1.0",
18
18
  "license": "MIT",
19
19
  "description": "Java grammar for tree-sitter",
20
20
  "authors": [