X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=blobdiff_plain;ds=sidebyside;f=helm%2Fmatita%2FmatitaScript.ml;h=c7859a7c7b96df61e8501b289d146237bc0b5709;hb=bdc855b1b6c9552a49a01769cb906a438ca60cc4;hp=f9855348a0d0ff9b6a4cc8224fd303aa527936e3;hpb=0a9583936e33eb9d65361537fd1e05168d423d11;p=helm.git diff --git a/helm/matita/matitaScript.ml b/helm/matita/matitaScript.ml index f9855348a..c7859a7c7 100644 --- a/helm/matita/matitaScript.ml +++ b/helm/matita/matitaScript.ml @@ -24,9 +24,11 @@ *) open Printf - open MatitaTypes +let debug = true +let debug_print = if debug then prerr_endline else ignore + (** raised when one of the script margins (top or bottom) is reached *) exception Margin @@ -91,8 +93,13 @@ let eval_with_engine status user_goal parsed_text st = let module UM = UriManager in DTE.fold ( fun k ((v,_) as value) acc -> - let v = UM.strip_xpointer (UM.uri_of_string v) in - if List.exists (fun (s,_) -> s = v) new_status.objects then + let b = + try + let v = UM.strip_xpointer (UM.uri_of_string v) in + List.exists (fun (s,_) -> s = v) new_status.objects + with UM.IllFormedUri _ -> false + in + if b then acc else DTE.add k value acc @@ -162,7 +169,7 @@ let eval_macro status (mathviewer:MatitaTypes.mathViewer) urichooser parsed_text let term = disambiguate term status in let uri = match term with - | Cic.MutInd (uri,n,_) -> UriManager.string_of_uriref (uri,[n]) + | Cic.MutInd (uri,n,_) -> UriManager.uri_of_string (UriManager.string_of_uriref (uri,[n])) | _ -> failwith "Not a MutInd" in let l = MQ.elim ~dbd uri in @@ -188,7 +195,7 @@ let eval_macro status (mathviewer:MatitaTypes.mathViewer) urichooser parsed_text (TA.Executable (loc, (TA.Tactical (loc, TA.Tactic (loc, - TA.Apply (loc, CicAst.Uri (uri,None))))))) + TA.Apply (loc, CicAst.Uri (UriManager.string_of_uri uri,None))))))) in let new_status = MatitaEngine.eval_ast status ast in let extra_text = @@ -200,7 +207,7 @@ let eval_macro status (mathviewer:MatitaTypes.mathViewer) urichooser parsed_text MatitaLog.error "The result of the urichooser should be only 1 uri, not:\n"; List.iter ( - fun u -> MatitaLog.error (u ^ "\n") + fun u -> MatitaLog.error (UriManager.string_of_uri u ^ "\n") ) selected; assert false) | TA.Check (_,term) ->