]> matita.cs.unibo.it Git - helm.git/blobdiff - helm/interface/annotationParser2.ml
This commit was manufactured by cvs2svn to create branch 'init'.
[helm.git] / helm / interface / annotationParser2.ml
diff --git a/helm/interface/annotationParser2.ml b/helm/interface/annotationParser2.ml
deleted file mode 100644 (file)
index 58edc4c..0000000
+++ /dev/null
@@ -1,129 +0,0 @@
-(* Copyright (C) 2000, HELM Team.
- * 
- * This file is part of HELM, an Hypertextual, Electronic
- * Library of Mathematics, developed at the Computer Science
- * Department, University of Bologna, Italy.
- * 
- * HELM is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- * 
- * HELM is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HELM; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston,
- * MA  02111-1307, USA.
- * 
- * For details, see the HELM World-Wide-Web page,
- * http://cs.unibo.it/helm/.
- *)
-
-exception IllFormedXml of int;;
-
-(* Utility functions that transform a Pxp attribute into something useful *)
-
-let string_of_attr a =
- let module T = Pxp_types in
-  match a with
-     T.Value s -> s
-   | _ -> raise (IllFormedXml 0)
-;;
-
-exception DontKnowWhatToDo;;
-
-let rec string_of_annotations n =
- let module D = Pxp_document in
- let module T = Pxp_types in
-  match n#node_type with
-     D.T_element s ->
-      "<" ^ s ^
-      List.fold_right
-       (fun att i ->
-         match n#attribute att with
-            T.Value s -> " " ^ att ^ "=\"" ^ s ^ "\"" ^ i
-          | T.Implied_value -> i
-          | T.Valuelist l -> " " ^ att ^ "=\"" ^ String.concat " " l ^ "\"" ^ i
-       ) (n#attribute_names) "" ^
-      (match n#sub_nodes with
-          [] -> "/>"
-        | l ->
-           ">" ^
-           String.concat "" (List.map string_of_annotations l) ^
-           "</" ^ s ^ ">"
-      )
-   | D.T_data -> n#data
-   | _ -> raise DontKnowWhatToDo
-;;
-
-let get_annotation n =
- String.concat "" (List.map string_of_annotations (n#sub_nodes))
-;;
-
-let annotate_object ann obj =
- let module C = Cic in
-  let rann =
-   match obj with
-      C.ADefinition (_, rann, _, _, _, _) -> rann
-    | C.AAxiom (_, rann, _, _, _) -> rann
-    | C.AVariable (_, rann, _, _, _) -> rann
-    | C.ACurrentProof (_, rann, _, _, _, _) -> rann
-    | C.AInductiveDefinition (_, rann, _, _, _) -> rann
-  in
-   rann := Some ann
-;;
-
-let annotate_term ann term =
- let module C = Cic in
-  let rann =
-   match term with
-      C.ARel (_, rann, _, _) -> rann
-    | C.AVar (_, rann, _) -> rann
-    | C.AMeta (_, rann, _) -> rann
-    | C.ASort (_, rann, _) -> rann
-    | C.AImplicit (_, rann) -> rann
-    | C.ACast (_, rann, _, _) -> rann
-    | C.AProd (_, rann, _, _, _) -> rann
-    | C.ALambda (_, rann, _, _, _) -> rann
-    | C.ALetIn (_, rann, _, _, _) -> rann
-    | C.AAppl (_, rann, _) -> rann
-    | C.AConst (_, rann, _, _) -> rann
-    | C.AAbst (_, rann, _) -> rann
-    | C.AMutInd (_, rann, _, _, _) -> rann
-    | C.AMutConstruct (_, rann, _, _, _, _) -> rann
-    | C.AMutCase (_, rann, _, _, _, _, _, _) -> rann
-    | C.AFix (_, rann, _, _) -> rann
-    | C.ACoFix (_, rann, _, _) -> rann
-  in
-   rann := Some ann
-;;
-
-let annotate ids_to_targets n =
- let module D = Pxp_document in
- let module C = Cic in
-  let annotate_elem n =
-   let ntype = n # node_type in
-   match ntype with
-     D.T_element "Annotation" ->
-       let of_uri = string_of_attr (n # attribute "of") in
-        begin
-         try
-          match Hashtbl.find ids_to_targets of_uri with
-             C.Object o -> annotate_object (get_annotation n) o
-           | C.Term t -> annotate_term (get_annotation n) t
-         with
-          Not_found -> assert false
-        end
-   | D.T_element _ | D.T_data ->
-      raise (IllFormedXml 1)
-   | _ -> raise DontKnowWhatToDo
-  in
-   match n # node_type with
-      D.T_element "Annotations" ->
-       List.iter annotate_elem (n # sub_nodes)
-    | _ -> raise (IllFormedXml 2)
-;;