@@ -140,7 +140,7 @@ module.exports = grammar({
140140
141141 type_param : $ => choice ( seq ( repeat1 ( choice ( "const" , "in" , "out" , "public" , "private" , "protected" , "readonly" ) ) , $ . ident , optional ( seq ( "extends" , $ . type ) ) , optional ( seq ( "=" , $ . type ) ) ) , seq ( choice ( "const" , "in" , "out" , "public" , "private" , "protected" , "readonly" ) , choice ( $ . ident , "in" , "out" ) , optional ( seq ( "extends" , $ . type ) ) , optional ( seq ( "=" , $ . type ) ) ) , seq ( choice ( $ . ident , "in" , "out" ) , optional ( seq ( "extends" , $ . type ) ) , optional ( seq ( "=" , $ . type ) ) ) ) ,
142142
143- decl : $ => choice ( seq ( optional ( "async" ) , "function" , optional ( "*" ) , field ( 'name' , $ . ident ) , optional ( $ . type_params ) , "(" , optional ( seq ( $ . param , repeat ( seq ( "," , $ . param ) ) , optional ( "," ) ) ) , ")" , optional ( seq ( ":" , $ . type ) ) , choice ( $ . block , optional ( ";" ) ) ) , seq ( "interface" , field ( 'name' , $ . ident ) , optional ( $ . type_params ) , optional ( seq ( "extends" , optional ( seq ( $ . type , repeat ( seq ( "," , $ . type ) ) , optional ( "," ) ) ) ) ) , "{" , repeat ( seq ( $ . interface_member , optional ( choice ( ";" , "," ) ) ) ) , "}" ) , seq ( "type" , field ( 'name' , $ . ident ) , optional ( $ . type_params ) , "=" , $ . type , optional ( ";" ) ) , seq ( repeat ( $ . decorator_expr ) , optional ( "abstract" ) , "class" , field ( 'name' , $ . ident ) , optional ( $ . type_params ) , optional ( seq ( "extends" , $ . class_heritage ) ) , optional ( seq ( "implements" , optional ( seq ( $ . type , repeat ( seq ( "," , $ . type ) ) , optional ( "," ) ) ) ) ) , "{" , repeat ( $ . class_member ) , "}" ) , seq ( "enum" , field ( 'name' , $ . ident ) , "{" , optional ( seq ( $ . enum_member , repeat ( seq ( "," , $ . enum_member ) ) , optional ( "," ) ) ) , "}" ) , seq ( "declare" , "function" , optional ( "*" ) , field ( 'name' , $ . ident ) , optional ( $ . type_params ) , "(" , optional ( seq ( $ . param , repeat ( seq ( "," , $ . param ) ) , optional ( "," ) ) ) , ")" , optional ( seq ( ":" , $ . type ) ) , optional ( ";" ) ) , seq ( "declare" , choice ( $ . decl , $ . stmt ) ) , seq ( "namespace" , field ( 'name' , $ . ident ) , "{" , repeat ( $ . stmt ) , "}" ) , seq ( "module" , choice ( $ . string , $ . ident ) , "{" , repeat ( $ . stmt ) , "}" ) , seq ( "export" , choice ( $ . decl , $ . stmt ) ) , seq ( "export" , "default" , choice ( seq ( optional ( "async" ) , "function" , optional ( "*" ) , optional ( field ( 'name' , $ . ident ) ) , optional ( $ . type_params ) , "(" , optional ( seq ( $ . param , repeat ( seq ( "," , $ . param ) ) , optional ( "," ) ) ) , ")" , optional ( seq ( ":" , $ . type ) ) , choice ( $ . block , optional ( ";" ) ) ) , seq ( "abstract" , "class" , field ( 'name' , $ . ident ) , optional ( $ . type_params ) , optional ( seq ( "extends" , $ . class_heritage ) ) , optional ( seq ( "implements" , optional ( seq ( $ . type , repeat ( seq ( "," , $ . type ) ) , optional ( "," ) ) ) ) ) , "{" , repeat ( $ . class_member ) , "}" ) , seq ( "abstract" , "class" , optional ( $ . type_params ) , optional ( seq ( "extends" , $ . class_heritage ) ) , optional ( seq ( "implements" , optional ( seq ( $ . type , repeat ( seq ( "," , $ . type ) ) , optional ( "," ) ) ) ) ) , "{" , repeat ( $ . class_member ) , "}" ) , seq ( $ . expr , optional ( ";" ) ) ) ) , seq ( "export" , "*" , choice ( seq ( "from" , $ . string , optional ( ";" ) ) , seq ( "as" , $ . ident , "from" , $ . string , optional ( ";" ) ) ) ) , seq ( "export" , "{" , optional ( seq ( $ . import_specifier , repeat ( seq ( "," , $ . import_specifier ) ) , optional ( "," ) ) ) , "}" , optional ( seq ( "from" , $ . string ) ) , optional ( ";" ) ) , seq ( "export" , "=" , $ . expr , optional ( ";" ) ) , seq ( "export" , "type" , "{" , optional ( seq ( $ . import_specifier , repeat ( seq ( "," , $ . import_specifier ) ) , optional ( "," ) ) ) , "}" , optional ( seq ( "from" , $ . string ) ) , optional ( ";" ) ) , seq ( "const" , "enum" , field ( 'name' , $ . ident ) , "{" , optional ( seq ( $ . enum_member , repeat ( seq ( "," , $ . enum_member ) ) , optional ( "," ) ) ) , "}" ) , seq ( "import" , choice ( seq ( $ . import_clause , "from" , $ . string , optional ( ";" ) ) , seq ( "type" , $ . import_clause , "from" , $ . string , optional ( ";" ) ) , seq ( $ . ident , "=" , $ . expr , optional ( ";" ) ) , seq ( $ . string , optional ( ";" ) ) ) ) , seq ( repeat ( $ . decorator_expr ) , "export" , choice ( $ . decl , $ . stmt ) ) ) ,
143+ decl : $ => choice ( seq ( optional ( "async" ) , "function" , optional ( "*" ) , field ( 'name' , $ . ident ) , optional ( $ . type_params ) , "(" , optional ( seq ( $ . param , repeat ( seq ( "," , $ . param ) ) , optional ( "," ) ) ) , ")" , optional ( seq ( ":" , $ . type ) ) , choice ( $ . block , optional ( ";" ) ) ) , seq ( "interface" , field ( 'name' , $ . ident ) , optional ( $ . type_params ) , optional ( seq ( "extends" , optional ( seq ( $ . type , repeat ( seq ( "," , $ . type ) ) , optional ( "," ) ) ) ) ) , "{" , repeat ( seq ( $ . interface_member , optional ( choice ( ";" , "," ) ) ) ) , "}" ) , seq ( "type" , $ . ident , optional ( $ . type_params ) , "=" , $ . type , optional ( ";" ) ) , seq ( repeat ( $ . decorator_expr ) , optional ( "abstract" ) , "class" , field ( 'name' , $ . ident ) , optional ( $ . type_params ) , optional ( seq ( "extends" , $ . class_heritage ) ) , optional ( seq ( "implements" , optional ( seq ( $ . type , repeat ( seq ( "," , $ . type ) ) , optional ( "," ) ) ) ) ) , "{" , repeat ( $ . class_member ) , "}" ) , seq ( "enum" , field ( 'name' , $ . ident ) , "{" , optional ( seq ( $ . enum_member , repeat ( seq ( "," , $ . enum_member ) ) , optional ( "," ) ) ) , "}" ) , seq ( "declare" , "function" , optional ( "*" ) , field ( 'name' , $ . ident ) , optional ( $ . type_params ) , "(" , optional ( seq ( $ . param , repeat ( seq ( "," , $ . param ) ) , optional ( "," ) ) ) , ")" , optional ( seq ( ":" , $ . type ) ) , optional ( ";" ) ) , seq ( "declare" , choice ( $ . decl , $ . stmt ) ) , seq ( "namespace" , field ( 'name' , $ . ident ) , "{" , repeat ( $ . stmt ) , "}" ) , seq ( "module" , choice ( $ . string , $ . ident ) , "{" , repeat ( $ . stmt ) , "}" ) , seq ( "export" , choice ( $ . decl , $ . stmt ) ) , seq ( "export" , "default" , choice ( seq ( optional ( "async" ) , "function" , optional ( "*" ) , optional ( field ( 'name' , $ . ident ) ) , optional ( $ . type_params ) , "(" , optional ( seq ( $ . param , repeat ( seq ( "," , $ . param ) ) , optional ( "," ) ) ) , ")" , optional ( seq ( ":" , $ . type ) ) , choice ( $ . block , optional ( ";" ) ) ) , seq ( "abstract" , "class" , field ( 'name' , $ . ident ) , optional ( $ . type_params ) , optional ( seq ( "extends" , $ . class_heritage ) ) , optional ( seq ( "implements" , optional ( seq ( $ . type , repeat ( seq ( "," , $ . type ) ) , optional ( "," ) ) ) ) ) , "{" , repeat ( $ . class_member ) , "}" ) , seq ( "abstract" , "class" , optional ( $ . type_params ) , optional ( seq ( "extends" , $ . class_heritage ) ) , optional ( seq ( "implements" , optional ( seq ( $ . type , repeat ( seq ( "," , $ . type ) ) , optional ( "," ) ) ) ) ) , "{" , repeat ( $ . class_member ) , "}" ) , seq ( $ . expr , optional ( ";" ) ) ) ) , seq ( "export" , "*" , choice ( seq ( "from" , $ . string , optional ( ";" ) ) , seq ( "as" , $ . ident , "from" , $ . string , optional ( ";" ) ) ) ) , seq ( "export" , "{" , optional ( seq ( $ . import_specifier , repeat ( seq ( "," , $ . import_specifier ) ) , optional ( "," ) ) ) , "}" , optional ( seq ( "from" , $ . string ) ) , optional ( ";" ) ) , seq ( "export" , "=" , $ . expr , optional ( ";" ) ) , seq ( "export" , "type" , "{" , optional ( seq ( $ . import_specifier , repeat ( seq ( "," , $ . import_specifier ) ) , optional ( "," ) ) ) , "}" , optional ( seq ( "from" , $ . string ) ) , optional ( ";" ) ) , seq ( "const" , "enum" , field ( 'name' , $ . ident ) , "{" , optional ( seq ( $ . enum_member , repeat ( seq ( "," , $ . enum_member ) ) , optional ( "," ) ) ) , "}" ) , seq ( "import" , choice ( seq ( $ . import_clause , "from" , $ . string , optional ( ";" ) ) , seq ( "type" , $ . import_clause , "from" , $ . string , optional ( ";" ) ) , seq ( $ . ident , "=" , $ . expr , optional ( ";" ) ) , seq ( $ . string , optional ( ";" ) ) ) ) , seq ( repeat ( $ . decorator_expr ) , "export" , choice ( $ . decl , $ . stmt ) ) ) ,
144144
145145 interface_member : $ => choice ( seq ( optional ( "new" ) , optional ( $ . type_params ) , "(" , optional ( seq ( $ . param , repeat ( seq ( "," , $ . param ) ) , optional ( "," ) ) ) , ")" , optional ( seq ( ":" , $ . type ) ) ) , seq ( choice ( "get" , "set" ) , $ . member_name , "(" , optional ( seq ( $ . param , repeat ( seq ( "," , $ . param ) ) , optional ( "," ) ) ) , ")" , optional ( seq ( ":" , $ . type ) ) ) , seq ( optional ( "static" ) , optional ( choice ( "+" , "-" ) ) , optional ( "readonly" ) , "[" , $ . ident , "in" , $ . type , optional ( seq ( "as" , $ . type ) ) , "]" , optional ( choice ( "+" , "-" ) ) , optional ( "?" ) , ":" , $ . type ) , seq ( "readonly" , $ . member_name , optional ( "?" ) , ":" , $ . type ) , seq ( $ . member_name , optional ( "?" ) , choice ( seq ( optional ( $ . type_params ) , "(" , optional ( seq ( $ . param , repeat ( seq ( "," , $ . param ) ) , optional ( "," ) ) ) , ")" , optional ( seq ( ":" , $ . type ) ) ) , optional ( seq ( ":" , $ . type ) ) ) ) , seq ( optional ( "static" ) , optional ( "readonly" ) , "[" , optional ( seq ( $ . param , repeat ( seq ( "," , $ . param ) ) , optional ( "," ) ) ) , "]" , optional ( seq ( ":" , $ . type ) ) ) ) ,
146146
0 commit comments