]> matita.cs.unibo.it Git - helm.git/blobdiff - helm/matita/matitacLib.ml
Added $Id$ to every .ml file.
[helm.git] / helm / matita / matitacLib.ml
index e769fd7d63bf7d19958006aad47b41ec1a99bb9b..3567c33f0a14575c683a75384381cab7c82dca61 100644 (file)
@@ -23,6 +23,8 @@
  * http://helm.cs.unibo.it/
  *)
 
+(* $Id$ *)
+
 open Printf
 
 open GrafiteTypes
@@ -112,20 +114,25 @@ let rec interactive_loop () =
   let str = Ulexing.from_utf8_channel stdin in
   try
     run_script str 
-      (MatitaEngine.eval_from_stream ~prompt:true
+      (MatitaEngine.eval_from_stream ~first_statement_only:false ~prompt:true
       ~include_paths:(Helm_registry.get_list Helm_registry.string
         "matita.includes"))
   with 
   | GrafiteEngine.Drop -> pp_ocaml_mode ()
+  | GrafiteEngine.Macro (floc,_) ->
+     let x, y = HExtlib.loc_of_floc floc in
+      HLog.error
+       (sprintf "A macro has been found in a script at %d-%d" x y);
+      interactive_loop ()
   | Sys.Break -> HLog.error "user break!"; interactive_loop ()
   | GrafiteTypes.Command_error _ -> interactive_loop ()
   | End_of_file ->
      print_newline ();
      clean_exit (Some 0)
   | HExtlib.Localized (floc,CicNotationParser.Parse_error err) ->
-     let (x, y) = HExtlib.loc_of_floc floc in
-     HLog.error (sprintf "Parse error at %d-%d: %s" x y err);
-     interactive_loop ()
+     let x, y = HExtlib.loc_of_floc floc in
+      HLog.error (sprintf "Parse error at %d-%d: %s" x y err);
+      interactive_loop ()
   | exn -> HLog.error (Printexc.to_string exn); interactive_loop ()
 
 let go () =
@@ -180,7 +187,7 @@ let main ~mode =
      Helm_registry.get_list Helm_registry.string "matita.includes" in
     (try
       run_script is 
-       (MatitaEngine.eval_from_stream ~include_paths
+       (MatitaEngine.eval_from_stream ~first_statement_only:false ~include_paths
          ~clean_baseuri:(not (Helm_registry.get_bool "matita.preserve")))
      with End_of_file -> ());
     let elapsed = Unix.time () -. time in
@@ -234,6 +241,14 @@ let main ~mode =
         clean_exit (Some 1)
       else 
         pp_ocaml_mode ()
+  | GrafiteEngine.Macro (floc,_) ->
+     let x, y = HExtlib.loc_of_floc floc in
+      HLog.error
+       (sprintf "A macro has been found in a script at %d-%d" x y);
+      if mode = `COMPILER then 
+        clean_exit (Some 1)
+      else 
+        pp_ocaml_mode ()
   | HExtlib.Localized (floc,CicNotationParser.Parse_error err) ->
      let (x, y) = HExtlib.loc_of_floc floc in
      HLog.error (sprintf "Parse error at %d-%d: %s" x y err);