1
+ const JavaScript = require ( 'tree-sitter-javascript/grammar' ) ;
2
+
1
3
module . exports = function defineGrammar ( dialect ) {
2
- return grammar ( require ( 'tree-sitter-javascript/grammar' ) , {
4
+ return grammar ( JavaScript , {
3
5
name : dialect ,
4
6
5
7
externals : ( $ , previous ) => previous . concat ( [
@@ -257,14 +259,14 @@ module.exports = function defineGrammar(dialect) {
257
259
'/>'
258
260
) ) ,
259
261
260
- export_specifier : ( $ , previous ) => seq (
262
+ export_specifier : ( _ , previous ) => seq (
261
263
optional ( choice ( 'type' , 'typeof' ) ) ,
262
264
previous
263
265
) ,
264
266
265
267
_import_identifier : $ => choice ( $ . identifier , alias ( 'type' , $ . identifier ) ) ,
266
268
267
- import_specifier : ( $ , previous ) => seq (
269
+ import_specifier : $ => seq (
268
270
optional ( choice ( 'type' , 'typeof' ) ) ,
269
271
choice (
270
272
field ( 'name' , $ . _import_identifier ) ,
@@ -275,7 +277,7 @@ module.exports = function defineGrammar(dialect) {
275
277
) ,
276
278
) ) ,
277
279
278
- import_clause : ( $ , previous ) => choice (
280
+ import_clause : $ => choice (
279
281
$ . namespace_import ,
280
282
$ . named_imports ,
281
283
seq (
@@ -352,7 +354,7 @@ module.exports = function defineGrammar(dialect) {
352
354
$ . _call_signature
353
355
) ,
354
356
355
- parenthesized_expression : ( $ , previous ) => seq (
357
+ parenthesized_expression : $ => seq (
356
358
'(' ,
357
359
choice (
358
360
seq ( $ . expression , field ( 'type' , optional ( $ . type_annotation ) ) ) ,
@@ -400,7 +402,7 @@ module.exports = function defineGrammar(dialect) {
400
402
$ . public_field_definition
401
403
) ,
402
404
choice ( $ . _semicolon , ',' )
403
- )
405
+ ) ,
404
406
) ) ,
405
407
'}'
406
408
) ,
@@ -601,7 +603,7 @@ module.exports = function defineGrammar(dialect) {
601
603
$ . _semicolon
602
604
) ,
603
605
604
- accessibility_modifier : $ => choice (
606
+ accessibility_modifier : _ => choice (
605
607
'public' ,
606
608
'private' ,
607
609
'protected'
@@ -883,15 +885,13 @@ module.exports = function defineGrammar(dialect) {
883
885
field ( 'argument' , $ . number )
884
886
) ) ,
885
887
886
- existential_type : $ => '*' ,
888
+ existential_type : _ => '*' ,
887
889
888
890
flow_maybe_type : $ => prec . right ( seq ( '?' , $ . _primary_type ) ) ,
889
891
890
- parenthesized_type : $ => seq (
891
- '(' , $ . _type , ')'
892
- ) ,
892
+ parenthesized_type : $ => seq ( '(' , $ . _type , ')' ) ,
893
893
894
- predefined_type : $ => choice (
894
+ predefined_type : _ => choice (
895
895
'any' ,
896
896
'number' ,
897
897
'boolean' ,
0 commit comments