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