| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
type t = Loc.t * Pp.t |
| 14 |
let make ~loc txt = loc, txt |
| 15 |
let pp (_,x) = x |
| 16 |
let pp_wloc (loc,x) = |
| 17 |
let open Pp in |
| 18 |
h (str "Replace " ++ Loc.pr loc ++ str " with " ++ x) |
| 19 |
let loc (l,_) = l |
| 20 |
|
| 21 |
let handle_stack = ref [] |
| 22 |
|
| 23 |
let register h = handle_stack := h::!handle_stack |
| 24 |
|
| 25 |
let rec accumulate_qf acc stk e = |
| 26 |
match stk with |
| 27 |
| [] -> acc |
| 28 |
| h::stk -> accumulate_qf (h e :: acc) stk e |
| 29 |
|
| 30 |
let from_exception e = |
| 31 |
try |
| 32 |
Ok (CList.flatten (accumulate_qf [] !handle_stack e)) |
| 33 |
with exn -> |
| 34 |
let ei = Exninfo.capture exn in |
| 35 |
Error ei |
| 36 |
|
| 37 |
let print e = |
| 38 |
let open Pp in |
| 39 |
match e with |
| 40 |
| [] -> mt () |
| 41 |
| qf -> |
| 42 |
let open Pp in |
| 43 |
let qf = prlist_with_sep cut pp_wloc qf in |
| 44 |
v 0 (prlist_with_sep cut (fun x -> x) [str "Quickfix:"; qf]) |