Skip to content

Commit a2fb3c1

Browse files
committed
Rename print_loc to pp in Stable_printer
Signed-off-by: Nathan Rebours <[email protected]>
1 parent 279c740 commit a2fb3c1

File tree

5 files changed

+11
-10
lines changed

5 files changed

+11
-10
lines changed

bin/test/main.ml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,8 @@ let report_error_in_block block msg =
5252
| Cram _ -> "cram "
5353
| Toplevel _ -> "toplevel "
5454
in
55-
Fmt.epr "%a: Error in the %scode block@]\n%s\n"
56-
Stable_printer.Location.print_loc block.loc kind msg
55+
Fmt.epr "%a: Error in the %scode block@]\n%s\n" Stable_printer.Location.pp
56+
block.loc kind msg
5757

5858
let run setup non_deterministic silent_eval record_backtrace syntax silent
5959
verbose_findlib prelude prelude_str file section root force_output output :

lib/block.ml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,10 @@ let loc_error ~loc fmt =
2020
Format.kasprintf
2121
(fun s -> Error (`Msg s))
2222
("%a: invalid code block: " ^^ fmt)
23-
Stable_printer.Location.print_loc loc
23+
Stable_printer.Location.pp loc
2424

2525
let locate_error_msg ~loc s =
26-
Format.asprintf "%a: invalid code block: %s" Stable_printer.Location.print_loc
27-
loc s
26+
Format.asprintf "%a: invalid code block: %s" Stable_printer.Location.pp loc s
2827

2928
let locate_errors ~loc r =
3029
Result.map_error
@@ -139,7 +138,7 @@ let dump ppf ({ loc; section; labels; contents; value; _ } as b) =
139138
Fmt.pf ppf
140139
"{@[loc: %a;@ section: %a;@ labels: %a;@ header: %a;@ contents: %a;@ \
141140
value: %a@]}"
142-
Stable_printer.Location.print_loc loc
141+
Stable_printer.Location.pp loc
143142
Fmt.(Dump.option dump_section)
144143
section
145144
Fmt.Dump.(list Label.pp)

lib/lexer_mdx.mll

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,8 @@ and cram_block = parse
116116
| exn ->
117117
let loc = Location.curr lexbuf in
118118
let msg =
119-
Format.asprintf "%a: %s" Stable_printer.Location.print_loc loc (Printexc.to_string exn)
119+
Format.asprintf "%a: %s" Stable_printer.Location.pp loc
120+
(Printexc.to_string exn)
120121
in
121122
Util.Result.errorf "%s" msg
122123

@@ -127,7 +128,8 @@ let cram_token lexbuf =
127128
| exn ->
128129
let loc = Location.curr lexbuf in
129130
let msg =
130-
Format.asprintf "%a: %s" Stable_printer.Location.print_loc loc (Printexc.to_string exn)
131+
Format.asprintf "%a: %s" Stable_printer.Location.pp loc
132+
(Printexc.to_string exn)
131133
in
132134
Util.Result.errorf "%s" msg
133135
}

lib/stable_printer.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
module Location = struct
22
open Location
33

4-
let print_loc ppf loc =
4+
let pp ppf loc =
55
(*setup_colors ();*)
66
let file_valid = function
77
| "_none_" ->

lib/stable_printer.mli

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@ Use this for user facing part of the code so that mdx's output does not
33
depend on the ocaml version it was built with. *)
44

55
module Location : sig
6-
val print_loc : Format.formatter -> Location.t -> unit
6+
val pp : Format.formatter -> Location.t -> unit
77
(** Prints location for error reporting as ["File <file>, lines <line-range>"] *)
88
end

0 commit comments

Comments
 (0)