in
ppterm_in_name_context ~metasenv subst term name_context
+let ppterm_in_context_ref = ref ppterm_in_context
+let set_ppterm_in_context f =
+ ppterm_in_context_ref := f
+let use_low_level_ppterm_in_context = ref false
+
+let ppterm_in_context ~metasenv subst term context =
+ if !use_low_level_ppterm_in_context then
+ ppterm_in_context ~metasenv subst term context
+ else
+ !ppterm_in_context_ref ~metasenv subst term context
+
let ppcontext' ~metasenv ?(sep = "\n") subst context =
let separate s = if s = "" then "" else s ^ sep in
List.fold_right
Cic.term * Cic.substitution * Cic.metasenv
(** {2 Pretty printers} *)
+val use_low_level_ppterm_in_context : bool ref
+val set_ppterm_in_context :
+ (metasenv:Cic.metasenv -> Cic.substitution -> Cic.term -> Cic.context ->
+ string) -> unit
val ppsubst_unfolded: metasenv:Cic.metasenv -> Cic.substitution -> string
val ppsubst: metasenv:Cic.metasenv -> Cic.substitution -> string
let txt_of_cic_term size metasenv context t =
let fake_sequent = (-1,context,t) in
txt_of_cic_sequent_conclusion size metasenv fake_sequent
+;;
+
+ignore (
+ CicMetaSubst.set_ppterm_in_context
+ (fun ~metasenv subst term context ->
+ try
+ let context' = CicMetaSubst.apply_subst_context subst context in
+ let term' = CicMetaSubst.apply_subst subst term in
+ txt_of_cic_term 30 metasenv context' term'
+ with
+ Sys.Break as exn -> raise exn
+ | exn ->
+ "[[ Exception raised during pretty-printing: " ^
+ Printexc.to_string exn ^ " ]] " ^
+ CicMetaSubst.ppterm_in_context ~metasenv subst term context)
+);;
(****************************************************************************)
(* txt_of_cic_object: IMPROVE ME *)
);
addDebugSeparator ();
*)
+ addDebugItem "disable high level pretty printer"
+ (fun _ -> CicMetaSubst.use_low_level_ppterm_in_context := true);
+ addDebugItem "enable high level pretty printer"
+ (fun _ -> CicMetaSubst.use_low_level_ppterm_in_context := false);
addDebugItem "disable all (pretty printing) notations"
(fun _ -> CicNotation.set_active_notations []);
addDebugItem "enable all (pretty printing) notations"