]> matita.cs.unibo.it Git - helm.git/blobdiff - helm/gTopLevel/batchParser.ml
- regtest now handles more than one interpretation: the tests committed
[helm.git] / helm / gTopLevel / batchParser.ml
index 1e301eaf945aa234146fef04e756105959f2525e..f7370422f7fccf70b03ebe0bd9508c0b27eb2223 100644 (file)
@@ -44,17 +44,20 @@ module DisambiguateCallbacks =
    ~selection_mode ?ok ?enable_button_for_non_vars ~title ~msg ~id choices =
      List.filter !uri_predicate choices
 
-  let interactive_interpretation_choice _ = fail "Multiple interpretations"
+  let interactive_interpretation_choice =
+   let rec aux n =
+    function
+       [] -> []
+     | _::tl -> n::(aux (n+1) tl)
+   in
+    aux 0
+
   let input_or_locate_uri ~title = fail "Unknown identifier"
  end
 
 module Disambiguate' = DisambiguatingParser.Make (DisambiguateCallbacks)
 
-let mqi_debug_fun = ignore
-let mqi_flags = []
-
-let parse ?(uri_pred = constants_only) =
-  let mqi_handle = MQIConn.init mqi_flags mqi_debug_fun in
+let parse mqi_handle ?(uri_pred = constants_only) =
   uri_predicate := uri_pred;
   let empty_environment =
     DisambiguatingParser.EnvironmentP3.of_string
@@ -63,11 +66,10 @@ let parse ?(uri_pred = constants_only) =
   let empty_context = [] in
   let empty_metasenv = [] in
   fun input ->
-    let (_, metasenv, term) =
-      Disambiguate'.disambiguate_term
-        mqi_handle empty_context empty_metasenv input empty_environment
-    in
-    MQIConn.close mqi_handle; (metasenv, term)
+   (Disambiguate'.disambiguate_term
+     mqi_handle empty_context empty_metasenv input empty_environment)
 
-let parse_pp ?uri_pred input = CicPp.ppterm (snd (parse ?uri_pred input))
+let parse_pp mqi_handle ?uri_pred input = 
+ List.map (fun (_,_,t) -> CicPp.ppterm t)
+  (parse mqi_handle ?uri_pred input)