fix Pattern Tuple issue, add to much ( and )

This commit is contained in:
Nicolas PENELOUX 2023-10-24 20:01:38 +02:00
parent 556f637cf6
commit f8d9068012

View file

@ -167,9 +167,14 @@ simple_pattern:
PWildcard PWildcard
} }
/* N-uplets ou parenthésage */ /* N-uplets ou parenthésage */
| LPAREN p=optionlist(separated_nonempty_list(COMMA, located(pattern))) RPAREN { | LPAREN RPAREN {
PTuple(p) PTuple([])
} }
| l=pattern_list {
match l with | [alone] -> Position.value alone | _ -> PTuple(l)
}
/* Annotation de type */ /* Annotation de type */
| p=located(simple_pattern) COLON ty=located(ty) { | p=located(simple_pattern) COLON ty=located(ty) {
PTypeAnnotation(p, ty) PTypeAnnotation(p, ty)
@ -341,7 +346,7 @@ expression:
Define(vd, e) Define(vd, e)
} }
/* Fonction anonyme */ /* Fonction anonyme */
| BACKSLASH p=located(pattern) ARROW e=located(expression) { | BACKSLASH p=located(pattern) ARROW e=located(expression){
Fun(FunctionDefinition(p, e)) Fun(FunctionDefinition(p, e))
} }
/* Application */ /* Application */