]> matita.cs.unibo.it Git - helm.git/blobdiff - matita/components/extlib/patternMatcher.ml
Porting to ocaml 5
[helm.git] / matita / components / extlib / patternMatcher.ml
index c1b436a97cf241d120109b6b7357d179f2f27d5d..4e3e75fa560234aca5d7577219b0df9775e08b22 100644 (file)
@@ -25,8 +25,6 @@
 
 (* $Id$ *)
 
-open Printf
-
 type pattern_kind = Variable | Constructor
 type tag_t = int
 
@@ -35,7 +33,7 @@ type pattern_id = int
 module OrderedInt =
 struct
   type t = int
-  let compare (x1:t) (x2:t) = Pervasives.compare x2 x1  (* reverse order *)
+  let compare (x1:t) (x2:t) = Stdlib.compare x2 x1  (* reverse order *)
 end
 
 module IntSet = Set.Make (OrderedInt)
@@ -113,15 +111,15 @@ struct
         | _ -> assert false)
       t
 
-  let variable_closure ksucc =
+  let variable_closure ksucc kfail =
     (fun matched_terms constructors terms ->
 (* prerr_endline "variable_closure"; *)
       match terms with
       | hd :: tl -> ksucc (hd :: matched_terms) constructors tl
-      | _ -> assert false)
+      | _ -> kfail () (*CSC: was assert false, but it did happen*))
 
   let success_closure ksucc =
-    (fun matched_terms constructors terms ->
+    (fun matched_terms constructors _terms ->
 (* prerr_endline "success_closure"; *)
        ksucc matched_terms constructors)
 
@@ -156,7 +154,7 @@ struct
       else
         match horizontal_split t with
         | _, [], _ -> assert false
-        | Variable, t', [] -> variable_closure (aux (vertical_split t'))
+        | Variable, t', [] -> variable_closure (aux (vertical_split t')) fail_k
         | Constructor, t', [] ->
             let tagl =
               List.map