Commit c3ff3266 authored by Pietro Abate's avatar Pietro Abate

minor modification in let binding syntax

- patterns used after a let binding must be enclosed in parenthesis
  consider : type t( 'a ) = [ 'a* ] ;;
  this function declaration works
    let (t(Int) & x) = [ 1 ] ;;
  while without parenthesis will raise a failure.
parent 6d5a5fb7
......@@ -94,6 +94,7 @@ let is_fun_decl =
(fun strm ->
match Stream.npeek 3 strm with
| [ KEYWORD "fun", _; IDENT _, _; KEYWORD "(", _ ]
| [ PTYPE _, _; _ ; _ ]
| [ IDENT _, _; KEYWORD "(", _; _ ] -> ()
| _ -> raise Stream.Failure
)
......@@ -490,8 +491,8 @@ EXTEND Gram
fun_decl: [
[ f = OPT located_ident; "("; (a,b) = fun_decl_after_lparen ->
(f,a,b)
[ f = OPT located_ident; "("; (a,b) = fun_decl_after_lparen -> (f,a,b)
| f = PTYPE; (a,b) = fun_decl_after_lparen -> (Some (lop _loc,ident f),a,b)
]
];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment