@@ -265,13 +265,13 @@ module.exports = function defineGrammar(dialect) {
265
265
import_specifier : ( $ , previous ) => seq (
266
266
optional ( choice ( 'type' , 'typeof' ) ) ,
267
267
choice (
268
- field ( 'name' , $ . _import_identifier ) ,
269
- seq (
270
- field ( 'name' , choice ( $ . _module_export_name , alias ( 'type' , $ . identifier ) ) ) ,
271
- 'as' ,
272
- field ( 'alias' , $ . _import_identifier )
273
- ) ,
274
- ) ) ,
268
+ field ( 'name' , $ . _import_identifier ) ,
269
+ seq (
270
+ field ( 'name' , choice ( $ . _module_export_name , alias ( 'type' , $ . identifier ) ) ) ,
271
+ 'as' ,
272
+ field ( 'alias' , $ . _import_identifier )
273
+ ) ,
274
+ ) ) ,
275
275
276
276
import_clause : ( $ , previous ) => choice (
277
277
$ . namespace_import ,
@@ -471,8 +471,8 @@ module.exports = function defineGrammar(dialect) {
471
471
) ,
472
472
473
473
_extends_clause_single : $ => prec ( 'extends' , seq (
474
- field ( 'value' , $ . expression ) ,
475
- field ( 'type_arguments' , optional ( $ . type_arguments ) )
474
+ field ( 'value' , $ . expression ) ,
475
+ field ( 'type_arguments' , optional ( $ . type_arguments ) )
476
476
) ) ,
477
477
478
478
implements_clause : $ => seq (
@@ -554,7 +554,7 @@ module.exports = function defineGrammar(dialect) {
554
554
field ( 'name' , $ . _type_identifier ) ,
555
555
field ( 'type_parameters' , optional ( $ . type_parameters ) ) ,
556
556
optional ( $ . extends_type_clause ) ,
557
- field ( 'body' , $ . object_type )
557
+ field ( 'body' , alias ( $ . object_type , $ . interface_body ) )
558
558
) ,
559
559
560
560
extends_type_clause : $ => seq (
@@ -752,16 +752,16 @@ module.exports = function defineGrammar(dialect) {
752
752
) ) ,
753
753
754
754
type_predicate : $ => seq (
755
- field ( 'name' , choice (
756
- $ . identifier ,
757
- $ . this ,
758
- // Sometimes tree-sitter contextual lexing is not good enough to know
759
- // that 'object' in ':object is foo' is really an identifier and not
760
- // a predefined_type, so we must explicitely list all possibilities.
761
- // TODO: should we use '_reserved_identifier'? Should all the element in
762
- // 'predefined_type' be added to '_reserved_identifier'?
763
- alias ( $ . predefined_type , $ . identifier )
764
- ) ) ,
755
+ field ( 'name' , choice (
756
+ $ . identifier ,
757
+ $ . this ,
758
+ // Sometimes tree-sitter contextual lexing is not good enough to know
759
+ // that 'object' in ':object is foo' is really an identifier and not
760
+ // a predefined_type, so we must explicitely list all possibilities.
761
+ // TODO: should we use '_reserved_identifier'? Should all the element in
762
+ // 'predefined_type' be added to '_reserved_identifier'?
763
+ alias ( $ . predefined_type , $ . identifier )
764
+ ) ) ,
765
765
'is' ,
766
766
field ( 'type' , $ . _type )
767
767
) ,
@@ -859,7 +859,7 @@ module.exports = function defineGrammar(dialect) {
859
859
860
860
existential_type : $ => '*' ,
861
861
862
- flow_maybe_type : $ => prec . right ( seq ( '?' , $ . _primary_type ) ) ,
862
+ flow_maybe_type : $ => prec . right ( seq ( '?' , $ . _primary_type ) ) ,
863
863
864
864
parenthesized_type : $ => seq (
865
865
'(' , $ . _type , ')'
@@ -1021,18 +1021,18 @@ module.exports = function defineGrammar(dialect) {
1021
1021
} ) ;
1022
1022
}
1023
1023
1024
- function commaSep1 ( rule ) {
1024
+ function commaSep1 ( rule ) {
1025
1025
return sepBy1 ( ',' , rule ) ;
1026
1026
}
1027
1027
1028
- function commaSep ( rule ) {
1028
+ function commaSep ( rule ) {
1029
1029
return sepBy ( ',' , rule ) ;
1030
1030
}
1031
1031
1032
- function sepBy ( sep , rule ) {
1032
+ function sepBy ( sep , rule ) {
1033
1033
return optional ( sepBy1 ( sep , rule ) )
1034
1034
}
1035
1035
1036
- function sepBy1 ( sep , rule ) {
1036
+ function sepBy1 ( sep , rule ) {
1037
1037
return seq ( rule , repeat ( seq ( sep , rule ) ) ) ;
1038
1038
}
0 commit comments