removed cruft, fixed ptset.ml
[SXSI/xpathcomp.git] / ata.ml
diff --git a/ata.ml b/ata.ml
index 6cdd9ef..f32005d 100644 (file)
--- a/ata.ml
+++ b/ata.ml
@@ -1,11 +1,9 @@
 INCLUDE "debug.ml"
 INCLUDE "utils.ml"
 
+
+
 type jump_kind = [ `TAG of Tag.t | `CONTAINS of string | `NOTHING ]
-let cpt_trans = ref 0
-let miss_trans = ref 0
-let cpt_eval = ref 0
-let miss_eval = ref 0
 
 (* Todo : move elsewhere *)
 external vb : bool -> int = "%identity"
@@ -213,14 +211,16 @@ module Transition = struct
                         s == s' && b==b' && m==m' && Formula.equal f f' 
                     end)
     
-  let print ppf f = let (st,mark,form,_) = node f in
+  let print ppf f = let (st,mark,form,b) = node f in
     Format.fprintf ppf "%i %s" st (if mark then "⇒" else "→");
     Formula.print ppf form;
-    Format.pp_print_flush ppf ()
+    Format.fprintf ppf "%s%!" (if b then " (b)" else "")
+
+
   module Infix = struct
   let ( ?< ) x = x
-  let ( >< ) state (l,mark) = state,(l,mark,true)
-  let ( ><@ ) state (l,mark) = state,(l,mark,false)
+  let ( >< ) state (l,mark) = state,(l,mark,false)
+  let ( ><@ ) state (l,mark) = state,(l,mark,true)
   let ( >=> ) (state,(label,mark,bur)) form = (state,label,(make (state,mark,form,bur)))
   end
 
@@ -364,11 +364,10 @@ module F = Formula
       Hashtbl.fold  
        (fun p l acc -> 
           if p == q then List.fold_left 
-          
-          (fun acc (ts,t) -> 
-             let _,_,_,aux = Transition.node t in
-               if aux then acc else
-               TagSet.cup ts acc) acc l
+            (fun acc (ts,t) -> 
+               let _,_,_,aux = Transition.node t in
+                 if aux then acc else
+                   TagSet.cup ts acc) acc l
           
           else acc) a.trans TagSet.empty
       
@@ -390,7 +389,6 @@ module F = Formula
     let next_sibling_ctx x _ = Tree.next_sibling x 
     let r_ignore _ x = x
       
-    let set_get_tag r t = r := (fun _ -> t)
 
     module type ResultSet = 
     sig
@@ -561,7 +559,7 @@ END
          (mk_fun (Tree.text_next) "Tree.text_next")
          (mk_fun (fun _ -> Tree.node_sibling_ctx) "[TaggedSibling]Tree.node_sibling_ctx")(* !! no tagged_sibling in Tree.ml *)
          (mk_fun (fun _ -> Tree.node_sibling_ctx) "[SelectSibling]Tree.node_sibling_ctx")(* !! no select_sibling in Tree.ml *)
-         (mk_fun (Tree.tagged_foll_below) "Tree.tagged_foll_below")
+         (mk_fun (Tree.tagged_foll_ctx) "Tree.tagged_foll_ctx")
          (mk_fun (fun _ -> Tree.node_sibling_ctx) "[SelectFoll]Tree.node_sibling_ctx")(* !! no select_foll *)
          (mk_fun (Tree.node_sibling_ctx) "Tree.node_sibling_ctx")        
                                
@@ -911,7 +909,7 @@ END
            match k with
              | `TAG (tag) -> 
                  (*Tree.tagged_lowest t tag, fun tree -> Tree.tagged_next tree tag*)
-                 (Tree.tagged_desc tag t, fun tree -> Tree.tagged_foll_below tag tree t)
+                 (Tree.tagged_desc tag t, fun tree -> Tree.tagged_foll_ctx tag tree t)
              | `CONTAINS(_) -> (Tree.text_below t,fun tree -> Tree.text_next tree t)
              | _ -> assert false
          in