]> matita.cs.unibo.it Git - helm.git/blobdiff - helm/matita/matitacleanLib.ml
merged cic_notation with matita: good luck!
[helm.git] / helm / matita / matitacleanLib.ml
index 06c6835ca5797b32b09a38e68c06cc55d88bb526..c34084d34d3f4933fa57845a7d86f586c399da0f 100644 (file)
@@ -30,10 +30,9 @@ module HGT = Http_getter_types;;
 module HG = Http_getter;;
 module HGM = Http_getter_misc;;
 module UM = UriManager;;
-module TA = TacticAst;;
+module TA = GrafiteAst;;
 
 let baseuri_of_baseuri_decl st =
-  let module TA = TacticAst in
   match st with
   | TA.Executable (_, TA.Command (_, TA.Set (_, "baseuri", buri))) ->
       Some buri
@@ -130,12 +129,12 @@ let close_uri_list uri_to_remove =
   uri_to_remove, depend
 
 let baseuri_of_file file = 
+  let uri = ref None in
   let ic = open_in file in
-  let stms = CicTextualParser2.parse_statements (Stream.of_channel ic) in
-  close_in ic;
-  let uri = ref "" in
-  List.iter 
-    (fun stm ->
+  let istream = Stream.of_channel ic in
+  (try
+    while true do
+      let stm = GrafiteParser.parse_statement istream in
       match baseuri_of_baseuri_decl stm with
       | Some buri -> 
           let u = MatitaMisc.strip_trailing_slash buri in
@@ -147,10 +146,14 @@ let baseuri_of_file file =
           | HGT.Unresolvable_URI _ -> 
               MatitaLog.error (file ^ " sets an unresolvable baseuri: "^buri)
           | HGT.Key_not_found _ -> ());
-          uri := u
-      | None -> ())
-    stms;
-  !uri
+          uri := Some u;
+          raise End_of_file
+      | None -> ()
+    done
+  with End_of_file -> close_in ic);
+  match !uri with
+  | Some uri -> uri
+  | None -> failwith ("No baseuri defined in " ^ file)
 
 let rec fix uris next =
   match next with