diff options
-rw-r--r-- | dev/db | 1 | ||||
-rw-r--r-- | dev/top_printers.ml | 15 |
2 files changed, 15 insertions, 1 deletions
@@ -3,6 +3,7 @@ load_printer "printers.cma" install_printer Top_printers.ppid install_printer Top_printers.ppidset +install_printer Top_printers.ppevarsubst install_printer Top_printers.ppintset install_printer Top_printers.pplab install_printer Top_printers.ppmsid diff --git a/dev/top_printers.ml b/dev/top_printers.ml index e64b86a81..d1893005d 100644 --- a/dev/top_printers.ml +++ b/dev/top_printers.ml @@ -64,10 +64,23 @@ let ppfconstr c = ppconstr (Closure.term_of_fconstr c) let ppbigint n = pp (Bigint.pr_bigint n);; -let prset pr l = str "[" ++ prlist_with_sep spc pr l ++ str "]" +let prset pr l = str "[" ++ hov 0 (prlist_with_sep spc pr l) ++ str "]" let ppintset l = pp (prset int (Intset.elements l)) let ppidset l = pp (prset pr_id (Idset.elements l)) +let prset' pr l = str "[" ++ hov 0 (prlist_with_sep pr_coma pr l) ++ str "]" +let ppidmap pr l = + let pr (id,b) = pr_id id ++ str "=>" ++ pr id b in + pp (prset' pr (Idmap.fold (fun a b l -> (a,b)::l) l [])) + +let ppevarsubst = ppidmap (fun id0 -> prset (fun (c,copt,id) -> + hov 0 + (Termops.print_constr c ++ + (match copt with None -> mt () | Some c -> spc () ++ str "<expanded: " ++ + Termops.print_constr c ++ str">") ++ + (if id = id0 then mt () + else spc () ++ str "<canonical: " ++ pr_id id ++ str ">")))) + let pP s = pp (hov 0 s) let safe_pr_global = function |