* Seal the representation of states
[tatoo.git] / src / xpath / compile.ml
index e8ab6fc..20f06be 100644 (file)
@@ -40,7 +40,7 @@ let root_set = QNameSet.singleton QName.document
 *)
 
 let compile_axis_test axis (test,kind) phi trans states =
-  let q = State.make () in
+  let q = State.next () in
   let phi = match kind with
     Tree.NodeKind.Node -> phi
   | _ -> phi %% F.is kind
@@ -65,7 +65,7 @@ let compile_axis_test axis (test,kind) phi trans states =
              ]) :: trans,
          states)
     | Descendant true ->
-        let q' = State.make () in
+        let q' = State.next () in
         (F.stay q ++ F.first_child q',
          (q', [ QNameSet.any => F.stay q ++ F.first_child q' ++ F.next_sibling q';
               ])::
@@ -73,7 +73,7 @@ let compile_axis_test axis (test,kind) phi trans states =
          states)
 
     | Parent ->
-        let q' = State.make () in
+        let q' = State.next () in
         let move = F.parent q ++ F.previous_sibling q' in
         (move,
          (q, [ test => phi ])
@@ -81,7 +81,7 @@ let compile_axis_test axis (test,kind) phi trans states =
          (q' @: states))
 
     | Ancestor self ->
-      let q' = State.make () in
+      let q' = State.next () in
       let move = F.parent q' ++ F.previous_sibling q' in
       (if self then F.stay q ++ F.stay q' else F.stay q'),
       (q', [ QNameSet.any => move ++ F.parent q])
@@ -208,7 +208,7 @@ let compile_top_level_step_list l trans states =
             in
             loop ll trans2 states2  phi2
   in
-  let starting = State.make () in
+  let starting = State.next () in
   let phi0, trans0, states0 =
     compile_axis_test
       Self
@@ -236,7 +236,7 @@ let path p =
   let builder = Ata.Builder.make () in
   (** ensure that we have a single selecting state at the end *)
   let phi_sel = StateSet.fold (fun q acc -> F.or_ (F.stay q) acc) mstates F.false_ in
-  let q_sel = State.make () in
+  let q_sel = State.next () in
   let states = StateSet.add q_sel states in
   let mstates = StateSet.singleton q_sel in
   let trans = (q_sel, [QNameSet.any, phi_sel]) :: trans in