ocaml-easy-format/ocaml-easy-format-stag.patch

110 lines
2.9 KiB
Diff

--- src/easy_format.ml.orig 2019-06-28 17:07:03.000000000 -0600
+++ src/easy_format.ml 2019-07-31 13:34:20.943340446 -0600
@@ -24,7 +24,7 @@ type label_break = [
| `Never
]
-type style_name = string
+type style_name = stag
type style = {
tag_open : string;
tag_close : string
@@ -193,25 +193,25 @@ struct
let rewrite x = propagate_forced_breaks x
(*
- Relies on the fact that mark_open_tag and mark_close_tag
+ Relies on the fact that mark_open_stag and mark_close_stag
are called exactly once before calling pp_output_string once.
It's a reasonable assumption although not guaranteed by the
documentation of the Format module.
*)
let set_escape fmt escape =
let print0, flush0 = pp_get_formatter_output_functions fmt () in
- let tagf0 = pp_get_formatter_tag_functions fmt () in
+ let tagf0 = pp_get_formatter_stag_functions fmt () in
let is_tag = ref false in
let mot tag =
is_tag := true;
- tagf0.mark_open_tag tag
+ tagf0.mark_open_stag tag
in
let mct tag =
is_tag := true;
- tagf0.mark_close_tag tag
+ tagf0.mark_close_stag tag
in
let print s p n =
@@ -224,12 +224,12 @@ struct
let tagf = {
tagf0 with
- mark_open_tag = mot;
- mark_close_tag = mct
+ mark_open_stag = mot;
+ mark_close_stag = mct
}
in
pp_set_formatter_output_functions fmt print flush0;
- pp_set_formatter_tag_functions fmt tagf
+ pp_set_formatter_stag_functions fmt tagf
let set_escape_string fmt esc =
@@ -261,12 +261,12 @@ struct
in
let tagf = {
- (pp_get_formatter_tag_functions fmt ()) with
- mark_open_tag = mark_open_tag;
- mark_close_tag = mark_close_tag
+ (pp_get_formatter_stag_functions fmt ()) with
+ mark_open_stag = mark_open_tag;
+ mark_close_stag = mark_close_tag
}
in
- pp_set_formatter_tag_functions fmt tagf
+ pp_set_formatter_stag_functions fmt tagf
);
(match escape with
@@ -319,19 +319,19 @@ struct
let open_tag fmt = function
None -> ()
- | Some s -> pp_open_tag fmt s
+ | Some s -> pp_open_stag fmt s
let close_tag fmt = function
None -> ()
- | Some _ -> pp_close_tag fmt ()
+ | Some _ -> pp_close_stag fmt ()
let tag_string fmt o s =
match o with
None -> pp_print_string fmt s
| Some tag ->
- pp_open_tag fmt tag;
+ pp_open_stag fmt tag;
pp_print_string fmt s;
- pp_close_tag fmt ()
+ pp_close_stag fmt ()
let rec fprint_t fmt = function
Atom (s, p) ->
--- src/easy_format.mli.orig 2019-06-28 17:07:03.000000000 -0600
+++ src/easy_format.mli 2019-07-31 13:37:55.536878786 -0600
@@ -53,7 +53,7 @@ type label_break = [
- [Never]: never break after the label
*)
-type style_name = string
+type style_name = Format.stag
type style = {
tag_open : string;