@@ -71,6 +71,7 @@ module.exports = grammar({
7171 [ $ . record_field , $ . record_pattern ] ,
7272 [ $ . expression_statement , $ . ternary_expression ] ,
7373 [ $ . _type_declaration ] ,
74+ [ $ . _let_binding ] ,
7475 [ $ . let_binding , $ . ternary_expression ] ,
7576 [ $ . variant_identifier , $ . module_identifier ] ,
7677 [ $ . variant ] ,
@@ -91,7 +92,8 @@ module.exports = grammar({
9192 [ $ . parameter , $ . _pattern ] ,
9293 [ $ . parameter , $ . _parenthesized_pattern ] ,
9394 [ $ . _switch_value_pattern , $ . _parenthesized_pattern ] ,
94- [ $ . variant_declaration ]
95+ [ $ . variant_declaration ] ,
96+ [ $ . unit , $ . _function_type_parameter_list ]
9597 ] ,
9698
9799 rules : {
@@ -245,16 +247,27 @@ module.exports = grammar({
245247 choice ( '=' , '+=' ) ,
246248 optional ( 'private' ) ,
247249 $ . _type ,
248- optional ( seq (
249- 'and' ,
250- $ . _type_declaration
251- ) ) ,
250+ repeat ( alias ( $ . _type_declaration_and , $ . type_declaration ) ) ,
252251 ) ) ,
253252 ) ,
254253
254+ _type_declaration_and : $ => seq (
255+ // New line here not necessary terminates the statement,
256+ // show this doubt to the parser
257+ repeat ( $ . _newline ) ,
258+ repeat ( $ . decorator ) ,
259+ 'and' ,
260+ $ . _type_declaration
261+ ) ,
262+
255263 type_parameters : $ => seq (
256264 '<' ,
257- commaSep1t ( $ . type_identifier ) ,
265+ commaSep1t (
266+ seq (
267+ optional ( choice ( '+' , '-' ) ) ,
268+ $ . type_identifier
269+ )
270+ ) ,
258271 '>' ,
259272 ) ,
260273
@@ -283,6 +296,7 @@ module.exports = grammar({
283296 $ . generic_type ,
284297 $ . unit_type ,
285298 $ . module_pack ,
299+ $ . unit ,
286300 ) ,
287301
288302 tuple_type : $ => prec . dynamic ( - 1 , seq (
@@ -422,13 +436,19 @@ module.exports = grammar({
422436 '=' ,
423437 repeat ( $ . decorator ) ,
424438 $ . expression ,
425- optional ( seq (
426- 'and' ,
427- $ . _let_binding ,
428- ) ) ,
439+ repeat ( alias ( $ . _let_binding_and , $ . let_binding ) ) ,
429440 ) ) ,
430441 ) ,
431442
443+ _let_binding_and : $ => seq (
444+ // New line here not necessary terminates the statement,
445+ // show this doubt to the parser
446+ repeat ( $ . _newline ) ,
447+ repeat ( $ . decorator ) ,
448+ 'and' ,
449+ $ . _let_binding ,
450+ ) ,
451+
432452 _binding_pattern : $ => choice (
433453 $ . value_identifier ,
434454 $ . tuple_pattern ,
0 commit comments