- | Sys.Break -> MatitaLog.error "user break!"; go ()
- | MatitaTypes.Command_error _ -> go ()
- | CicTextualParser2.Parse_error (floc,err) ->
- (* check for EOI *)
- if Stream.peek str = None then
- exit 0
- else
- let (x, y) = CicAst.loc_of_floc floc in
- MatitaLog.error (sprintf "Parse error at %d-%d: %s" x y err);
- | exn -> MatitaLog.error (Printexc.to_string exn); go ()
+ | Sys.Break -> MatitaLog.error "user break!"; interactive_loop ()
+ | MatitaTypes.Command_error _ -> interactive_loop ()
+ | End_of_file ->
+ print_newline ();
+ clean_exit (Some 0)
+ | CicNotationParser.Parse_error (floc,err) ->
+ let (x, y) = CicNotationPt.loc_of_floc floc in
+ MatitaLog.error (sprintf "Parse error at %d-%d: %s" x y err);
+ interactive_loop ()
+ | exn -> MatitaLog.error (Printexc.to_string exn); interactive_loop ()
+
+let go () =
+ Helm_registry.load_from BuildTimeConf.matita_conf;
+ CicNotation.load_notation BuildTimeConf.core_notation_script;
+ Http_getter.init ();
+ MetadataTypes.ownerize_tables (Helm_registry.get "matita.owner");
+ MatitaDb.create_owner_environment ();
+ CicEnvironment.set_trust (* environment trust *)
+ (let trust = Helm_registry.get_bool "matita.environment_trust" in
+ fun _ -> trust);
+ status := Some (ref (Lazy.force MatitaEngine.initial_status));
+ Sys.catch_break true;
+ interactive_loop ()
+
+let dump_moo_to_file file moo =
+ let os = open_out (MatitaMisc.obj_file_of_script file) in
+ let output s = output_string os s in
+ output "(* GENERATED FILE: DO NOT EDIT! *)\n\n";
+ List.iter
+ (fun cmd -> output (GrafiteAstPp.pp_command cmd ^ "\n"))
+ (List.rev moo);
+ close_out os