@@ -106,7 +106,8 @@ module.exports = grammar({
106106 [ $ . variant_declaration ] ,
107107 [ $ . unit , $ . _function_type_parameter_list ] ,
108108 [ $ . functor_parameter , $ . module_primary_expression , $ . module_identifier_path ] ,
109- [ $ . _reserved_identifier , $ . function ]
109+ [ $ . _reserved_identifier , $ . function ] ,
110+ [ $ . polyvar_type ]
110111 ] ,
111112
112113 rules : {
@@ -364,6 +365,7 @@ module.exports = grammar({
364365 ) ,
365366
366367 polyvar_type : $ => prec . left ( seq (
368+ repeat ( $ . decorator ) ,
367369 choice ( '[' , '[>' , '[<' , ) ,
368370 optional ( '|' ) ,
369371 barSep1 ( $ . polyvar_declaration ) ,
@@ -374,7 +376,7 @@ module.exports = grammar({
374376 polyvar_declaration : $ => prec . right (
375377 choice (
376378 seq (
377- optional ( $ . decorator ) ,
379+ repeat ( $ . decorator ) ,
378380 $ . polyvar_identifier ,
379381 optional ( $ . polyvar_parameters ) ,
380382 ) ,
@@ -629,19 +631,27 @@ module.exports = grammar({
629631
630632 tuple : $ => seq (
631633 '(' ,
632- commaSep2t ( $ . expression ) ,
634+ commaSep2t (
635+ seq ( repeat ( $ . decorator ) , $ . expression )
636+ ) ,
633637 ')' ,
634638 ) ,
635639
636640 array : $ => seq (
637641 '[' ,
638- commaSept ( $ . expression ) ,
642+ commaSept (
643+ seq ( repeat ( $ . decorator ) , $ . expression )
644+ ) ,
639645 ']'
640646 ) ,
641647
642648 list : $ => seq (
643649 'list{' ,
644- optional ( commaSep1t ( $ . _list_element ) ) ,
650+ optional (
651+ commaSep1t (
652+ seq ( repeat ( $ . decorator ) , $ . _list_element )
653+ )
654+ ) ,
645655 '}'
646656 ) ,
647657
@@ -799,6 +809,7 @@ module.exports = grammar({
799809 seq (
800810 '=' ,
801811 optional ( '?' ) ,
812+ repeat ( $ . decorator ) ,
802813 field ( 'value' , $ . expression ) ,
803814 optional ( field ( 'type' , $ . type_annotation ) ) ,
804815 ) ,
@@ -931,19 +942,28 @@ module.exports = grammar({
931942
932943 tuple_pattern : $ => seq (
933944 '(' ,
934- commaSep2t ( alias ( $ . _pattern , $ . tuple_item_pattern ) ) ,
945+ commaSep2t (
946+ alias (
947+ seq ( repeat ( $ . decorator ) , $ . _pattern ) ,
948+ $ . tuple_item_pattern
949+ )
950+ ) ,
935951 ')' ,
936952 ) ,
937953
938954 array_pattern : $ => seq (
939955 '[' ,
940- optional ( commaSep1t ( $ . _collection_element_pattern ) ) ,
956+ optional ( commaSep1t (
957+ seq ( repeat ( $ . decorator ) , $ . _collection_element_pattern )
958+ ) ) ,
941959 ']' ,
942960 ) ,
943961
944962 list_pattern : $ => seq (
945963 'list{' ,
946- optional ( commaSep1t ( $ . _collection_element_pattern ) ) ,
964+ optional ( commaSep1t (
965+ seq ( repeat ( $ . decorator ) , $ . _collection_element_pattern )
966+ ) ) ,
947967 '}' ,
948968 ) ,
949969
0 commit comments