@willbooster/tree-sitter-java 3.0.4 → 3.1.1
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 +85 -18
- package/package.json +1 -1
- package/src/node-types.json +12 -0
- package/tree-sitter-java.wasm +0 -0
- package/tree-sitter.json +1 -1
package/grammar.js
CHANGED
|
@@ -80,7 +80,6 @@ module.exports = grammar({
|
|
|
80
80
|
[$.modifiers, $.annotated_type, $.module_declaration, $.package_declaration],
|
|
81
81
|
[$._unannotated_type, $.primary_expression, $.inferred_parameters],
|
|
82
82
|
[$._unannotated_type, $.primary_expression],
|
|
83
|
-
[$._unannotated_type, $.primary_expression, $.scoped_type_identifier],
|
|
84
83
|
[$._unannotated_type, $.scoped_type_identifier],
|
|
85
84
|
[$._unannotated_type, $.generic_type],
|
|
86
85
|
[$.generic_type, $.primary_expression],
|
|
@@ -90,8 +89,70 @@ module.exports = grammar({
|
|
|
90
89
|
[$.inferred_parameters, $.primary_expression],
|
|
91
90
|
[$.argument_list, $.record_pattern_body],
|
|
92
91
|
[$.yield_statement, $._reserved_identifier],
|
|
92
|
+
[$.scoped_identifier, $.scoped_type_identifier],
|
|
93
|
+
[$.primary_expression, $.method_reference, $.scoped_identifier],
|
|
94
|
+
[$.primary_expression, $.method_reference, $.scoped_identifier, $._unannotated_type, $.scoped_type_identifier],
|
|
93
95
|
],
|
|
94
96
|
|
|
97
|
+
reserved: {
|
|
98
|
+
global: $ => [
|
|
99
|
+
'abstract',
|
|
100
|
+
'assert',
|
|
101
|
+
'boolean',
|
|
102
|
+
'break',
|
|
103
|
+
'byte',
|
|
104
|
+
'case',
|
|
105
|
+
'catch',
|
|
106
|
+
'char',
|
|
107
|
+
'class',
|
|
108
|
+
$._const,
|
|
109
|
+
'continue',
|
|
110
|
+
'default',
|
|
111
|
+
'do',
|
|
112
|
+
'double',
|
|
113
|
+
'else',
|
|
114
|
+
'enum',
|
|
115
|
+
'extends',
|
|
116
|
+
'final',
|
|
117
|
+
'finally',
|
|
118
|
+
'float',
|
|
119
|
+
'for',
|
|
120
|
+
$._goto,
|
|
121
|
+
'if',
|
|
122
|
+
'implements',
|
|
123
|
+
'import',
|
|
124
|
+
'instanceof',
|
|
125
|
+
'int',
|
|
126
|
+
'interface',
|
|
127
|
+
'long',
|
|
128
|
+
'native',
|
|
129
|
+
'new',
|
|
130
|
+
'package',
|
|
131
|
+
'private',
|
|
132
|
+
'protected',
|
|
133
|
+
'public',
|
|
134
|
+
'return',
|
|
135
|
+
'short',
|
|
136
|
+
'static',
|
|
137
|
+
'strictfp',
|
|
138
|
+
$.super,
|
|
139
|
+
'switch',
|
|
140
|
+
'synchronized',
|
|
141
|
+
$.this,
|
|
142
|
+
'throw',
|
|
143
|
+
'throws',
|
|
144
|
+
'transient',
|
|
145
|
+
'try',
|
|
146
|
+
'void',
|
|
147
|
+
'volatile',
|
|
148
|
+
'while',
|
|
149
|
+
$.underscore_pattern,
|
|
150
|
+
$.true,
|
|
151
|
+
$.false,
|
|
152
|
+
$.null_literal,
|
|
153
|
+
],
|
|
154
|
+
},
|
|
155
|
+
|
|
95
156
|
word: $ => $.identifier,
|
|
96
157
|
|
|
97
158
|
rules: {
|
|
@@ -102,7 +163,6 @@ module.exports = grammar({
|
|
|
102
163
|
$.method_declaration,
|
|
103
164
|
),
|
|
104
165
|
|
|
105
|
-
|
|
106
166
|
_literal: $ => choice(
|
|
107
167
|
$.decimal_integer_literal,
|
|
108
168
|
$.hex_integer_literal,
|
|
@@ -226,7 +286,6 @@ module.exports = grammar({
|
|
|
226
286
|
|
|
227
287
|
null_literal: _ => 'null',
|
|
228
288
|
|
|
229
|
-
|
|
230
289
|
expression: $ => choice(
|
|
231
290
|
$.assignment_expression,
|
|
232
291
|
$.binary_expression,
|
|
@@ -311,7 +370,7 @@ module.exports = grammar({
|
|
|
311
370
|
|
|
312
371
|
lambda_expression: $ => seq(
|
|
313
372
|
field('parameters', choice(
|
|
314
|
-
$.identifier, $.formal_parameters, $.inferred_parameters, $._reserved_identifier,
|
|
373
|
+
$.identifier, $.formal_parameters, $.inferred_parameters, $._reserved_identifier, $.underscore_pattern,
|
|
315
374
|
)),
|
|
316
375
|
'->',
|
|
317
376
|
field('body', choice($.expression, $.block)),
|
|
@@ -319,7 +378,7 @@ module.exports = grammar({
|
|
|
319
378
|
|
|
320
379
|
inferred_parameters: $ => seq(
|
|
321
380
|
'(',
|
|
322
|
-
commaSep1(choice($.identifier, $._reserved_identifier)),
|
|
381
|
+
commaSep1(choice($.identifier, $._reserved_identifier, $.underscore_pattern)),
|
|
323
382
|
')',
|
|
324
383
|
),
|
|
325
384
|
|
|
@@ -452,11 +511,19 @@ module.exports = grammar({
|
|
|
452
511
|
|
|
453
512
|
argument_list: $ => seq('(', commaSep($.expression), ')'),
|
|
454
513
|
|
|
455
|
-
method_reference: $ =>
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
514
|
+
method_reference: $ => choice(
|
|
515
|
+
seq(
|
|
516
|
+
choice($._type, $.primary_expression, $.super),
|
|
517
|
+
'::',
|
|
518
|
+
optional($.type_arguments),
|
|
519
|
+
choice('new', $.identifier),
|
|
520
|
+
),
|
|
521
|
+
seq(
|
|
522
|
+
$._name, '.', $.super,
|
|
523
|
+
'::',
|
|
524
|
+
optional($.type_arguments),
|
|
525
|
+
$.identifier,
|
|
526
|
+
),
|
|
460
527
|
),
|
|
461
528
|
|
|
462
529
|
type_arguments: $ => seq(
|
|
@@ -538,7 +605,6 @@ module.exports = grammar({
|
|
|
538
605
|
|
|
539
606
|
guard: $ => seq('when', $.expression),
|
|
540
607
|
|
|
541
|
-
|
|
542
608
|
statement: $ => choice(
|
|
543
609
|
$.declaration,
|
|
544
610
|
$.expression_statement,
|
|
@@ -706,7 +772,6 @@ module.exports = grammar({
|
|
|
706
772
|
field('body', $.statement),
|
|
707
773
|
),
|
|
708
774
|
|
|
709
|
-
|
|
710
775
|
_annotation: $ => choice(
|
|
711
776
|
$.marker_annotation,
|
|
712
777
|
$.annotation,
|
|
@@ -751,7 +816,6 @@ module.exports = grammar({
|
|
|
751
816
|
'}',
|
|
752
817
|
),
|
|
753
818
|
|
|
754
|
-
|
|
755
819
|
declaration: $ => prec(PREC.DECL, choice(
|
|
756
820
|
$.module_declaration,
|
|
757
821
|
$.package_declaration,
|
|
@@ -843,9 +907,10 @@ module.exports = grammar({
|
|
|
843
907
|
|
|
844
908
|
import_declaration: $ => seq(
|
|
845
909
|
'import',
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
910
|
+
choice(
|
|
911
|
+
seq('module', $._name),
|
|
912
|
+
seq(optional('static'), $._name, optional(seq('.', $.asterisk))),
|
|
913
|
+
),
|
|
849
914
|
';',
|
|
850
915
|
),
|
|
851
916
|
|
|
@@ -981,8 +1046,8 @@ module.exports = grammar({
|
|
|
981
1046
|
|
|
982
1047
|
constructor_body: $ => seq(
|
|
983
1048
|
'{',
|
|
984
|
-
optional($.explicit_constructor_invocation),
|
|
985
1049
|
repeat($.statement),
|
|
1050
|
+
optional(seq($.explicit_constructor_invocation, repeat($.statement))),
|
|
986
1051
|
'}',
|
|
987
1052
|
),
|
|
988
1053
|
|
|
@@ -1131,7 +1196,6 @@ module.exports = grammar({
|
|
|
1131
1196
|
'}',
|
|
1132
1197
|
),
|
|
1133
1198
|
|
|
1134
|
-
|
|
1135
1199
|
_type: $ => choice(
|
|
1136
1200
|
$._unannotated_type,
|
|
1137
1201
|
$.annotated_type,
|
|
@@ -1284,6 +1348,9 @@ module.exports = grammar({
|
|
|
1284
1348
|
alias('yield', $.identifier),
|
|
1285
1349
|
),
|
|
1286
1350
|
|
|
1351
|
+
_const: _ => /const/,
|
|
1352
|
+
_goto: _ => /goto/,
|
|
1353
|
+
|
|
1287
1354
|
this: _ => 'this',
|
|
1288
1355
|
|
|
1289
1356
|
super: _ => 'super',
|
package/package.json
CHANGED
package/src/node-types.json
CHANGED
|
@@ -2249,6 +2249,10 @@
|
|
|
2249
2249
|
{
|
|
2250
2250
|
"type": "identifier",
|
|
2251
2251
|
"named": true
|
|
2252
|
+
},
|
|
2253
|
+
{
|
|
2254
|
+
"type": "underscore_pattern",
|
|
2255
|
+
"named": true
|
|
2252
2256
|
}
|
|
2253
2257
|
]
|
|
2254
2258
|
}
|
|
@@ -2459,6 +2463,10 @@
|
|
|
2459
2463
|
{
|
|
2460
2464
|
"type": "inferred_parameters",
|
|
2461
2465
|
"named": true
|
|
2466
|
+
},
|
|
2467
|
+
{
|
|
2468
|
+
"type": "underscore_pattern",
|
|
2469
|
+
"named": true
|
|
2462
2470
|
}
|
|
2463
2471
|
]
|
|
2464
2472
|
}
|
|
@@ -2684,6 +2692,10 @@
|
|
|
2684
2692
|
"type": "primary_expression",
|
|
2685
2693
|
"named": true
|
|
2686
2694
|
},
|
|
2695
|
+
{
|
|
2696
|
+
"type": "scoped_identifier",
|
|
2697
|
+
"named": true
|
|
2698
|
+
},
|
|
2687
2699
|
{
|
|
2688
2700
|
"type": "super",
|
|
2689
2701
|
"named": true
|
package/tree-sitter-java.wasm
CHANGED
|
Binary file
|