]> matita.cs.unibo.it Git - helm.git/blobdiff - helm/software/matita/matitaEngine.ml
nasty change in the lexer/parser:
[helm.git] / helm / software / matita / matitaEngine.ml
index 7e5b20860811c87afe4891317be25770988d22f9..a8dcf98092e29a8d68009d012a6469ed3542f18f 100644 (file)
@@ -25,7 +25,7 @@
 
 (* $Id$ *)
 
-open Printf
+module G = GrafiteAst
 
 let debug = false ;;
 let debug_print = if debug then prerr_endline else ignore ;;
@@ -61,6 +61,7 @@ let disambiguate_macro lexicon_status_ref grafite_status macro context =
 let eval_ast ?do_heavy_checks lexicon_status
  grafite_status (text,prefix_len,ast)
 =
+ let dump = not (Helm_registry.get_bool "matita.moo") in
  let lexicon_status_ref = ref lexicon_status in
  let baseuri = GrafiteTypes.get_baseuri grafite_status in
  let changed_lexicon = ref false in
@@ -76,11 +77,18 @@ let eval_ast ?do_heavy_checks lexicon_status
           { s with NTacStatus.istatus = { s.NTacStatus.istatus with NTacStatus.lstatus =  lexicon_status }}}
  in
  let new_grafite_status,new_objs =
+  match ast with 
+     | G.Executable (_, G.Command (_, G.Coercion _)) when dump ->
+(* FG: some commands can not be executed when mmas are parsed *************)
+(* To be removed when mmas will be executed                               *)
+        grafite_status, `Old []
+     | ast -> 
   GrafiteEngine.eval_ast
    ~disambiguate_tactic:(wrap (disambiguate_tactic text prefix_len lexicon_status_ref))
    ~disambiguate_command:(wrap (disambiguate_command lexicon_status_ref))
    ~disambiguate_macro:(wrap (disambiguate_macro lexicon_status_ref))
-   ?do_heavy_checks grafite_status (text,prefix_len,ast) in
+   ?do_heavy_checks grafite_status (text,prefix_len,ast)
+ in
  let new_lexicon_status =
   if !changed_lexicon then
    !lexicon_status_ref
@@ -129,10 +137,6 @@ let eval_ast ?do_heavy_checks lexicon_status
 exception TryingToAdd of string
 exception EnrichedWithStatus of exn * LexiconEngine.status * GrafiteTypes.status
 
-let out = ref ignore 
-
-let set_callback f = out := f
-
 let eval_from_stream ~first_statement_only ~include_paths 
  ?do_heavy_checks ?(enforce_no_new_aliases=true)
  ?(watch_statuses=fun _ _ -> ()) lexicon_status grafite_status str cb 
@@ -160,7 +164,6 @@ let eval_from_stream ~first_statement_only ~include_paths
             false, lexicon_status, grafite_status,
              (((grafite_status,lexicon_status),None)::statuses)
          | GrafiteParser.LSome ast ->
-            !out ast;
             cb grafite_status ast;
             let new_statuses =
              eval_ast ?do_heavy_checks lexicon_status