]> matita.cs.unibo.it Git - helm.git/blobdiff - helm/matita/matitacleanLib.ml
Bug fixed: matitaclean and matitadep now ignores every parsing errors and
[helm.git] / helm / matita / matitacleanLib.ml
index 8b54e98d9e767c0064bfa1bf8b8bb337dce92e9f..51635a30a130426a9986b829c34f2fe00d0fcff4 100644 (file)
@@ -134,21 +134,27 @@ let baseuri_of_file file =
   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
-          if String.length u < 5 || String.sub u 0 5 <> "cic:/" then
-            MatitaLog.error (file ^ " sets an incorrect baseuri: " ^ buri);
-          (try 
-            ignore(HG.resolve u)
-          with
-          | HGT.Unresolvable_URI _ -> 
-              MatitaLog.error (file ^ " sets an unresolvable baseuri: "^buri)
-          | HGT.Key_not_found _ -> ());
-          uri := Some u;
-          raise End_of_file
-      | None -> ()
+      try 
+        let stm = GrafiteParser.parse_statement istream in
+        match baseuri_of_baseuri_decl stm with
+        | Some buri -> 
+            let u = MatitaMisc.strip_trailing_slash buri in
+            if String.length u < 5 || String.sub u 0 5 <> "cic:/" then
+              MatitaLog.error (file ^ " sets an incorrect baseuri: " ^ buri);
+            (try 
+              ignore(HG.resolve u)
+            with
+            | HGT.Unresolvable_URI _ -> 
+                MatitaLog.error (file ^ " sets an unresolvable baseuri: "^buri)
+            | HGT.Key_not_found _ -> ());
+            uri := Some u;
+            raise End_of_file
+        | None -> ()
+      with
+        CicNotationParser.Parse_error _ as exn ->
+          prerr_endline ("Unable to parse: " ^ file);
+          prerr_endline (MatitaExcPp.to_string exn);
+          ()
     done
   with End_of_file -> close_in ic);
   match !uri with