]> matita.cs.unibo.it Git - helm.git/blobdiff - helm/ocaml/cic_notation/cicNotationRew.ml
avoid generating multiple times the same xref/href
[helm.git] / helm / ocaml / cic_notation / cicNotationRew.ml
index e54d5b48152098e8b33ffcec7a316a9a6d98a49a..28edd491c84e7e32e97425176cb728e007e723e3 100644 (file)
@@ -87,7 +87,8 @@ let vbox = box Ast.V
 let hvbox = box Ast.HV
 let hovbox = box Ast.HOV
 let break = Ast.Layout Ast.Break
-let reset_href t = Ast.AttributedTerm (`Href [], t)
+(* let reset_href t = Ast.AttributedTerm (`Href [], t) *)
+let reset_href t = t
 let builtin_symbol s = reset_href (Ast.Literal (`Symbol s))
 let keyword k = reset_href (add_keyword_attrs (Ast.Literal (`Keyword k)))
 let number s =
@@ -259,7 +260,9 @@ let ast_of_acic0 term_info acic k =
   let sort_of_id id =
     try
       Hashtbl.find term_info.sort id
-    with Not_found -> assert false
+    with Not_found ->
+      prerr_endline (sprintf "warning: sort of id %s not found, using Type" id);
+      `Type
   in
   let aux_substs substs =
     Some
@@ -529,9 +532,10 @@ let rec ast_of_acic1 term_info annterm =
         with Not_found -> assert false
       in
       let ast = instantiate32 term_info env' symbol args in
-      match uris with
-      | [] -> ast
-      | _ -> Ast.AttributedTerm (`Href uris, ast)
+      Ast.AttributedTerm (`IdRef (CicUtil.id_of_annterm annterm),
+        (match uris with
+        | [] -> ast
+        | _ -> Ast.AttributedTerm (`Href uris, ast)))
 
 let load_patterns32 t =
   set_compiled32 (lazy (CicNotationMatcher.Matcher32.compiler t))