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
let istream = Stream.of_channel ic in
(try
while true do
- match GrafiteParser.parse_statement istream with
- | TA.Executable (_, TA.Command (_, TA.Set (_, "baseuri", uri))) ->
- let uri = MatitaMisc.strip_trailing_slash uri in
- baseuri := (uri, file) :: !baseuri
- | TA.Executable (_, TA.Command
- (_, TA.Alias (_, TA.Ident_alias(_, uri)))) ->
- Hashtbl.add aliases file uri
- | TA.Executable (_, TA.Command (_, TA.Include (_, path))) ->
- Hashtbl.add deps file (find path)
- | _ -> ()
+ try
+ match GrafiteParser.parse_statement istream with
+ | TA.Executable (_, TA.Command (_, TA.Set (_, "baseuri", uri))) ->
+ let uri = MatitaMisc.strip_trailing_slash uri in
+ baseuri := (uri, file) :: !baseuri
+ | TA.Executable (_, TA.Command
+ (_, TA.Alias (_, TA.Ident_alias(_, uri)))) ->
+ Hashtbl.add aliases file uri
+ | TA.Executable (_, TA.Command (_, TA.Include (_, path))) ->
+ Hashtbl.add deps file (find path)
+ | _ -> ()
+ with
+ CicNotationParser.Parse_error _ as exn ->
+ prerr_endline ("Unable to parse: " ^ file);
+ prerr_endline (MatitaExcPp.to_string exn);
+ ()
done
with
- | CicNotationParser.Parse_error _ as exn ->
- prerr_endline ("Unable to parse: " ^ file);
- prerr_endline (MatitaExcPp.to_string exn);
- exit 1
| End_of_file -> close_in ic);
Hashtbl.iter
(fun file alias ->