summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSon Ho2022-02-02 17:12:07 +0100
committerSon Ho2022-02-02 17:12:07 +0100
commit7e87e22c3b739583b695d9c46ac44e00e941f9b7 (patch)
treea9aeb7b9292a0d6435ec9296c501c6c2df540352
parent412d7215517f42c90ba6f53432798a5eef093475 (diff)
Improve formatting even more
-rw-r--r--src/ExtractToFStar.ml9
-rw-r--r--src/Translate.ml3
2 files changed, 8 insertions, 4 deletions
diff --git a/src/ExtractToFStar.ml b/src/ExtractToFStar.ml
index 340092b4..6fd141cc 100644
--- a/src/ExtractToFStar.ml
+++ b/src/ExtractToFStar.ml
@@ -222,9 +222,9 @@ let extract_type_def_struct_body (ctx : extraction_ctx) (fmt : F.formatter)
else (
F.pp_print_space fmt ();
F.pp_print_string fmt "{";
+ F.pp_print_break fmt 1 ctx.indent_incr;
(* The body itself *)
- F.pp_open_hvbox fmt ctx.indent_incr;
- F.pp_print_space fmt ();
+ F.pp_open_hvbox fmt 0;
(* Print the fields *)
let print_field (field_id : FieldId.id) (f : field) : unit =
let field_name = ctx_get_field def.def_id field_id ctx in
@@ -235,11 +235,12 @@ let extract_type_def_struct_body (ctx : extraction_ctx) (fmt : F.formatter)
F.pp_print_space fmt ();
extract_ty ctx fmt false f.field_ty;
F.pp_print_string fmt ";";
- F.pp_print_space fmt ();
F.pp_close_box fmt ()
in
let fields = FieldId.mapi (fun fid f -> (fid, f)) fields in
- List.iter (fun (fid, f) -> print_field fid f) fields;
+ Collections.List.iter_link (F.pp_print_space fmt)
+ (fun (fid, f) -> print_field fid f)
+ fields;
(* Close *)
F.pp_close_box fmt ();
F.pp_print_space fmt ();
diff --git a/src/Translate.ml b/src/Translate.ml
index 874d852e..75975704 100644
--- a/src/Translate.ml
+++ b/src/Translate.ml
@@ -322,6 +322,9 @@ let translate_module (filename : string) (config : C.partial_config)
trans_funs)
in
+ (* Set the margin *)
+ Format.pp_set_margin fmt 80;
+
(* Create a vertical box *)
Format.pp_open_vbox fmt 0;