let _ =
List.iter (fun k -> Hashtbl.add level2_ast_keywords k ())
[ "CProp"; "Prop"; "Type"; "Set"; "let"; "rec"; "corec"; "match";
- "with"; "in"; "and"; "to"; "as"; "on" ]
+ "with"; "in"; "and"; "to"; "as"; "on"; "return" ]
let add_level2_ast_keyword k = Hashtbl.add level2_ast_keywords k ()
let remove_level2_ast_keyword k = Hashtbl.remove level2_ast_keywords k
| m = META; s = meta_substs ->
return_term loc (Ast.Meta (int_of_string m, s))
| s = sort -> return_term loc (Ast.Sort s)
- | outtyp = OPT [ SYMBOL "["; ty = term; SYMBOL "]" -> ty ];
- "match"; t = term;
+ | "match"; t = term;
indty_ident = OPT [ "in"; id = IDENT -> id, None ];
+ outtyp = OPT [ "return"; ty = term -> ty ];
"with"; SYMBOL "[";
patterns = LIST0 [
lhs = match_pattern; SYMBOL <:unicode<Rightarrow>> (* ⇒ *);
match outty_opt with
| None -> []
| Some outty ->
- [ builtin_symbol "["; remove_level_info (k outty);
- builtin_symbol "]"; break ]
+ [ keyword "return"; break; remove_level_info (k outty)]
in
let indty_box =
match indty_opt with
| None -> []
- | Some (indty, href) -> [ keyword "in"; ident_w_href href indty ]
+ | Some (indty, href) -> [ keyword "in"; break; ident_w_href href indty ]
in
let match_box =
- hvbox false true [
- keyword "match"; break;
- hvbox false false ([ top_pos (k what) ] @ indty_box); break;
- keyword "with" ]
+ hvbox false false [
+ hvbox false true [
+ hvbox false true [ keyword "match"; break; top_pos (k what) ];
+ break;
+ hvbox false true indty_box;
+ break;
+ hvbox false true outty_box
+ ];
+ break;
+ keyword "with"
+ ]
in
let mk_case_pattern (head, href, vars) =
hbox true false (ident_w_href href head :: List.map aux_var vars)
in
add_level_info Ast.simple_prec Ast.simple_assoc
(hvbox false false [
- hvbox false false (outty_box @ [ match_box ]); break;
+ hvbox false false ([match_box]); break;
hbox false false [ hvbox false false patterns'' ] ])
| Ast.Cast (bo, ty) ->
add_level_info Ast.simple_prec Ast.simple_assoc