@willbooster/tree-sitter-java 3.0.0 → 3.0.2

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
@@ -9,9 +9,9 @@
9
9
  /// <reference types="tree-sitter-cli/dsl" />
10
10
  // @ts-check
11
11
 
12
- const DIGITS = token(choice('0', seq(/[1-9]/, optional(seq(optional('_'), sep1(/[0-9]+/, /_+/))))));
13
- const DECIMAL_DIGITS = token(sep1(/[0-9]+/, '_'));
14
- const HEX_DIGITS = token(sep1(/[A-Fa-f0-9]+/, '_'));
12
+ const DECIMAL_DIGITS = token(sep1(/[0-9]+/, /_+/));
13
+ const DIGITS = token(choice('0', seq(/[1-9]/, optional(seq(optional(/_+/), DECIMAL_DIGITS)))));
14
+ const HEX_DIGITS = token(sep1(/[A-Fa-f0-9]+/, /_+/));
15
15
 
16
16
  /* eslint-disable no-multi-spaces */
17
17
 
@@ -72,6 +72,9 @@ module.exports = grammar({
72
72
  ],
73
73
 
74
74
  conflicts: $ => [
75
+ [$.dimensions],
76
+ [$.array_type, $._unannotated_type],
77
+ [$.array_type, $.primary_expression],
75
78
  [$.modifiers, $.annotated_type, $.receiver_parameter],
76
79
  [$.modifiers, $.annotated_type, $.module_declaration, $.package_declaration],
77
80
  [$._unannotated_type, $.primary_expression, $.inferred_parameters],
@@ -126,22 +129,22 @@ module.exports = grammar({
126
129
  )),
127
130
 
128
131
  octal_integer_literal: _ => token(seq(
129
- choice('0o', '0O', '0'),
130
- sep1(/[0-7]+/, '_'),
132
+ choice('0o', '0O', seq('0', optional(/_+/))),
133
+ sep1(/[0-7]+/, /_+/),
131
134
  optional(choice('l', 'L')),
132
135
  )),
133
136
 
134
137
  binary_integer_literal: _ => token(seq(
135
138
  choice('0b', '0B'),
136
- sep1(/[01]+/, '_'),
139
+ sep1(/[01]+/, /_+/),
137
140
  optional(choice('l', 'L')),
138
141
  )),
139
142
 
140
143
  decimal_floating_point_literal: _ => token(choice(
141
144
  seq(DECIMAL_DIGITS, '.', optional(DECIMAL_DIGITS), optional(seq((/[eE]/), optional(choice('-', '+')), DECIMAL_DIGITS)), optional(/[fFdD]/)),
142
145
  seq('.', DECIMAL_DIGITS, optional(seq((/[eE]/), optional(choice('-', '+')), DECIMAL_DIGITS)), optional(/[fFdD]/)),
143
- seq(DIGITS, /[eE]/, optional(choice('-', '+')), DECIMAL_DIGITS, optional(/[fFdD]/)),
144
- seq(DIGITS, optional(seq((/[eE]/), optional(choice('-', '+')), DECIMAL_DIGITS)), (/[fFdD]/)),
146
+ seq(DECIMAL_DIGITS, /[eE]/, optional(choice('-', '+')), DECIMAL_DIGITS, optional(/[fFdD]/)),
147
+ seq(DECIMAL_DIGITS, optional(seq((/[eE]/), optional(choice('-', '+')), DECIMAL_DIGITS)), (/[fFdD]/)),
145
148
  )),
146
149
 
147
150
  hex_floating_point_literal: _ => token(seq(
@@ -153,7 +156,7 @@ module.exports = grammar({
153
156
  optional(seq(
154
157
  /[pP]/,
155
158
  optional(choice('-', '+')),
156
- DIGITS,
159
+ DECIMAL_DIGITS,
157
160
  optional(/[fFdD]/),
158
161
  )),
159
162
  )),
@@ -474,9 +477,9 @@ module.exports = grammar({
474
477
  seq($.super, $._type),
475
478
  ),
476
479
 
477
- dimensions: $ => prec.right(repeat1(
480
+ dimensions: $ => repeat1(
478
481
  seq(repeat($._annotation), '[', ']'),
479
- )),
482
+ ),
480
483
 
481
484
  switch_expression: $ => seq(
482
485
  'switch',
@@ -634,7 +637,10 @@ module.exports = grammar({
634
637
  $._variable_declarator_id,
635
638
  ),
636
639
 
637
- catch_type: $ => sep1($._unannotated_type, '|'),
640
+ catch_type: $ => seq(
641
+ $._unannotated_type,
642
+ repeat(seq('|', $._type)),
643
+ ),
638
644
 
639
645
  finally_clause: $ => seq('finally', $.block),
640
646
 
@@ -1175,7 +1181,7 @@ module.exports = grammar({
1175
1181
  )),
1176
1182
 
1177
1183
  array_type: $ => seq(
1178
- field('element', $._unannotated_type),
1184
+ field('element', $._simple_type),
1179
1185
  field('dimensions', $.dimensions),
1180
1186
  ),
1181
1187
 
@@ -1240,8 +1246,8 @@ module.exports = grammar({
1240
1246
  spread_parameter: $ => seq(
1241
1247
  optional($.modifiers),
1242
1248
  $._unannotated_type,
1243
- '...',
1244
1249
  repeat($._annotation),
1250
+ '...',
1245
1251
  $.variable_declarator,
1246
1252
  ),
1247
1253
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@willbooster/tree-sitter-java",
3
- "version": "3.0.0",
3
+ "version": "3.0.2",
4
4
  "description": "Java grammar for tree-sitter",
5
5
  "keywords": [
6
6
  "incremental",
@@ -735,7 +735,31 @@
735
735
  "required": true,
736
736
  "types": [
737
737
  {
738
- "type": "_unannotated_type",
738
+ "type": "boolean_type",
739
+ "named": true
740
+ },
741
+ {
742
+ "type": "floating_point_type",
743
+ "named": true
744
+ },
745
+ {
746
+ "type": "generic_type",
747
+ "named": true
748
+ },
749
+ {
750
+ "type": "integral_type",
751
+ "named": true
752
+ },
753
+ {
754
+ "type": "scoped_type_identifier",
755
+ "named": true
756
+ },
757
+ {
758
+ "type": "type_identifier",
759
+ "named": true
760
+ },
761
+ {
762
+ "type": "void_type",
739
763
  "named": true
740
764
  }
741
765
  ]
@@ -1093,7 +1117,7 @@
1093
1117
  "required": true,
1094
1118
  "types": [
1095
1119
  {
1096
- "type": "_unannotated_type",
1120
+ "type": "_type",
1097
1121
  "named": true
1098
1122
  }
1099
1123
  ]
Binary file
package/tree-sitter.json CHANGED
@@ -14,7 +14,7 @@
14
14
  }
15
15
  ],
16
16
  "metadata": {
17
- "version": "3.0.0",
17
+ "version": "3.0.2",
18
18
  "license": "MIT",
19
19
  "description": "Java grammar for tree-sitter",
20
20
  "authors": [