| `Closed -> "▪"
| `Type -> ""
| `Hole -> "□"
+ | `Tagged s -> "[\"" ^ s ^ "\"]"
| `Term -> "Term"
| `Typeof x -> "Ty("^string_of_int x^")"
| `Vector -> "…"
F.fprintf formatter "%s" sep
;;
+let ppmetaattrs =
+ function
+ [] -> ""
+ | attrs ->
+ "(" ^
+ String.concat ","
+ (List.map
+ (function
+ `IsSort -> "sort"
+ | `Name n -> "name=" ^ n
+ | `InScope -> "in_scope"
+ | `OutScope n -> "out_scope:" ^ string_of_int n
+ ) attrs) ^
+ ")"
+;;
+
let rec ppmetasenv ~formatter ~subst metasenv = function
| [] -> ()
- | (i,(name, ctx, ty)) :: tl ->
+ | (i,(attrs, ctx, ty)) :: tl ->
F.fprintf formatter "@[<hov 2>";
- let name = match name with Some n -> "("^n^")" | _ -> "" in
ppcontext ~formatter ~sep:"; " ~subst ~metasenv ctx;
- F.fprintf formatter "@;⊢@;?%d%s :@;" i name;
+ F.fprintf formatter "@;⊢@;?%d%s :@;" i (ppmetaattrs attrs);
ppterm ~formatter ~metasenv ~subst ~context:ctx ty;
F.fprintf formatter "@]@\n";
ppmetasenv ~formatter ~subst metasenv tl
let rec ppsubst ~formatter ~subst ~metasenv = function
| [] -> ()
- | (i,(name, ctx, t, ty)) :: tl ->
- let name = match name with Some n -> "("^n^")" | _ -> "" in
+ | (i,(attrs, ctx, t, ty)) :: tl ->
ppcontext ~formatter ~sep:"; " ~subst ~metasenv ctx;
- F.fprintf formatter " ⊢ ?%d%s := " i name;
+ F.fprintf formatter " ⊢ ?%d%s := " i (ppmetaattrs attrs);
ppterm ~formatter ~metasenv ~subst ~context:ctx t;
F.fprintf formatter " : ";
ppterm ~formatter ~metasenv ~subst ~context:ctx ty;
ppsubst ~formatter ~metasenv ~subst subst
;;
+let string_of_generated = function
+ | `Generated -> "Generated"
+ | `Provided -> "Provided"
+;;
+
+let string_of_flavour = function
+ | `Definition -> "Definition"
+ | `Fact -> "Fact"
+ | `Lemma -> "Lemma"
+ | `Theorem -> "Theorem"
+ | `Corollary -> "Corollary"
+ | `Example -> "Example"
+;;
+
+let string_of_pragma = function
+ | `Coercion _arity -> "Coercion _"
+ | `Elim _sort -> "Elim _"
+ | `Projection -> "Projection"
+ | `InversionPrinciple -> "InversionPrinciple"
+ | `Variant -> "Variant"
+ | `Local -> "Local"
+ | `Regular -> "Regular"
+;;
+
+let string_of_fattrs (g,f,p) =
+ String.concat ","
+ [ string_of_generated g; string_of_flavour f; string_of_pragma p ]
+;;
+
let ppobj ~formatter (u,_,metasenv, subst, o) =
F.fprintf formatter "metasenv:\n";
ppmetasenv ~formatter ~subst metasenv;
(*ppsubst subst ~formatter ~metasenv;*) F.fprintf formatter "...";
F.fprintf formatter "\n";
match o with
- | NCic.Fixpoint (b, fl, _) ->
+ | NCic.Fixpoint (b, fl, attrs) ->
F.fprintf formatter "{%s}@\n@[<hov 0>" (NUri.string_of_uri u);
F.fprintf formatter "@[<hov 2>%s"(if b then "let rec " else "let corec ");
HExtlib.list_iter_sep
F.fprintf formatter "@]@;@[<hov 2>:=@;";
ppterm ~formatter ~metasenv ~subst ~context:[] ~inside_fix:true bo;
F.fprintf formatter "@]") fl;
- F.fprintf formatter "@]"
+ F.fprintf formatter "@; %s" (string_of_fattrs attrs);
+ F.fprintf formatter "@]"
| NCic.Inductive (b, leftno,tyl, _) ->
F.fprintf formatter "{%s} with %d fixed params@\n@[<hov 0>@[<hov 2>%s"
(NUri.string_of_uri u) leftno