[ LPAREN; id = single_arg; SYMBOL ":"; typ = term; RPAREN ->
id, Some typ
| arg = single_arg -> arg, None
+ | id = PIDENT -> Ast.Ident (id, None), None
| SYMBOL "_" -> Ast.Ident ("_", None), None
+ | LPAREN; id = PIDENT; SYMBOL ":"; typ = term; RPAREN ->
+ Ast.Ident (id, None), Some typ
| LPAREN; SYMBOL "_"; SYMBOL ":"; typ = term; RPAREN ->
Ast.Ident ("_", None), Some typ
]
];
match_pattern: [
- [ id = IDENT -> Ast.Pattern (id, None, [])
+ [ SYMBOL "_" -> Ast.Wildcard
+ | id = IDENT -> Ast.Pattern (id, None, [])
| LPAREN; id = IDENT; vars = LIST1 possibly_typed_name; RPAREN ->
Ast.Pattern (id, None, vars)
| id = IDENT; vars = LIST1 possibly_typed_name ->
Ast.Pattern (id, None, vars)
- | SYMBOL "_" -> Ast.Wildcard
]
];
binder: [
]
];
binder_vars: [
- [ vars = [
- l = LIST1 single_arg SEP SYMBOL "," -> l
- | SYMBOL "_" -> [Ast.Ident ("_", None)] ];
+ [ vars = [ l =
+ [ l = LIST1 single_arg SEP SYMBOL "," -> l
+ | l = LIST1 [ PIDENT | SYMBOL "_" ] SEP SYMBOL "," ->
+ List.map (fun x -> Ast.Ident(x,None)) l
+ ] -> l ];
typ = OPT [ SYMBOL ":"; t = term -> t ] -> (vars, typ)
]
];