]> matita.cs.unibo.it Git - helm.git/blobdiff - helm/software/components/ng_kernel/nCicPp.ml
- NCicPp.ppterm applies the substitution
[helm.git] / helm / software / components / ng_kernel / nCicPp.ml
index 5f29d25d87093d71cf26875d045e7af5e99ec614..73c3f572c0ff1dbade596812d08ae80c25f84ae6 100644 (file)
 
 (* $Id$ *)
 
-let ppterm = 
-  ref (fun ~context:_ ~subst:_ ~metasenv:_ ?inside_fix _ -> 
-         ignore (inside_fix) ; "Please, set a pp callback")
-;;
-
-let set_ppterm f = ppterm := f;;
-
-let ppterm ~context ~subst ~metasenv ?inside_fix t = 
-  !ppterm ~context ~subst ~metasenv ?inside_fix t
-;;
-
 module C = NCic
 module R = NReference
 
@@ -54,7 +43,7 @@ let r2s pp_fix_name r =
   with NCicLibrary.ObjectNotFound _ -> R.string_of_reference r
 ;;
 
-let trivial_pp_term ~context ~subst:_ ~metasenv:_ ?(inside_fix=false) t = 
+let ppterm ~context ~subst ~metasenv:_ ?(inside_fix=false) t = 
   let buff = Buffer.create 100 in
   let f = Format.formatter_of_buffer buff in
   let module F = Format in
@@ -132,11 +121,18 @@ let trivial_pp_term ~context ~subst:_ ~metasenv:_ ?(inside_fix=false) t =
        if not toplevel then F.fprintf f ")";
        F.fprintf f "@]"
    | C.Implicit _ -> F.fprintf f "?"
+   | C.Meta (n,lc) when List.mem_assoc n subst -> 
+        let _,_,t,_ = List.assoc n subst in
+        aux ctx (NCicSubstitution.subst_meta lc t)
    | C.Meta (n,(shift,C.Irl len)) -> 
         F.fprintf f "?%d(%d,%d)" n shift len
    | C.Meta (n,(shift,C.Ctx l)) -> 
         F.fprintf f "?%d(%d,[" n shift;
-        List.iter (fun x -> aux ctx x; F.fprintf f ",") l;
+        if List.length l > 0 then
+          begin 
+            aux ctx (List.hd l);
+            List.iter (fun x -> F.fprintf f ",";aux ctx x) (List.tl l);
+          end;
         F.fprintf f "])"
    | C.Sort C.Prop -> F.fprintf f "Prop"
    | C.Sort (C.Type []) -> F.fprintf f "IllFormedUniverse"