@@ -589,17 +589,20 @@ module.exports = grammar({
589
589
590
590
typevar_parameter : $ => seq (
591
591
field ( 'name' , $ . identifier ) ,
592
- optional ( $ . _type_bound )
592
+ optional ( $ . _type_bound ) ,
593
+ optional ( $ . _type_param_default )
593
594
) ,
594
595
595
596
typevartuple_parameter : $ => seq (
596
597
'*' ,
597
598
field ( 'name' , $ . identifier ) ,
599
+ optional ( $ . _type_param_default )
598
600
) ,
599
601
600
602
paramspec_parameter : $ => seq (
601
603
'**' ,
602
604
field ( 'name' , $ . identifier ) ,
605
+ optional ( $ . _type_param_default ) ,
603
606
) ,
604
607
605
608
_type_parameter : $ => choice (
@@ -608,6 +611,11 @@ module.exports = grammar({
608
611
$ . paramspec_parameter ,
609
612
) ,
610
613
614
+ _type_param_default : $ => seq (
615
+ '=' ,
616
+ field ( 'default' , choice ( $ . list_splat , $ . expression ) )
617
+ ) ,
618
+
611
619
parenthesized_list_splat : $ => prec ( PREC . parenthesized_list_splat , seq (
612
620
'(' ,
613
621
choice (
@@ -923,7 +931,7 @@ module.exports = grammar({
923
931
subscript : $ => prec ( PREC . call , seq (
924
932
field ( 'value' , $ . primary_expression ) ,
925
933
'[' ,
926
- commaSep1 ( field ( 'subscript' , choice ( $ . expression , $ . slice ) ) ) ,
934
+ commaSep1 ( field ( 'subscript' , choice ( $ . list_splat , $ . expression , $ . slice ) ) ) ,
927
935
optional ( ',' ) ,
928
936
']'
929
937
) ) ,
0 commit comments