Add backward moves in the syntax of the automaton.
authorkim <kim@3cdefd35-fc62-479d-8e8d-bae585ffb9ca>
Thu, 19 Jan 2012 09:48:52 +0000 (09:48 +0000)
committerkim <kim@3cdefd35-fc62-479d-8e8d-bae585ffb9ca>
Thu, 19 Jan 2012 09:48:52 +0000 (09:48 +0000)
git-svn-id: svn+ssh://idea.nguyen.vg/svn/sxsi/trunk/xpathcomp@1186 3cdefd35-fc62-479d-8e8d-bae585ffb9ca

src/formula.ml
src/formula.mli
src/runtime.ml

index 16db6d5..3b344e7 100644 (file)
@@ -6,7 +6,7 @@ type 'hcons expr =
   | False | True
   | Or of 'hcons * 'hcons
   | And of 'hcons * 'hcons
-  | Atom of ([ `Left | `Right ] * bool * State.t)
+  | Atom of ([ `Left | `Right | `Epsilon ] * bool * State.t)
   | Pred of Tree.Predicate.t
 
 type 'hcons node = {
@@ -78,6 +78,7 @@ let rec print ?(parent=false) ppf f =
          match  dir with
            | `Left ->  Pretty.down_arrow, Pretty.subscript 1
            | `Right -> Pretty.down_arrow, Pretty.subscript 2
+           | `Epsilon -> Pretty.epsilon, ""
        in
          fprintf fmt "%s%s" a_str d_str;
          State.print fmt s;
@@ -109,6 +110,7 @@ let atom_ d p s =
   let ss = match d with
     | `Left -> (si,StateSet.empty,si),empty_triple
     | `Right -> empty_triple,(si,StateSet.empty,si)
+    | `Epsilon -> empty_triple, empty_triple
   in fst (cons (Atom(d,p,s)) (Atom(d,not p,s)) ss ss 1 1)
 
 let pred_ p =
index 88763ee..1dd05e2 100644 (file)
@@ -3,7 +3,7 @@ type 'a expr =
     | True
     | Or of 'a * 'a
     | And of 'a * 'a
-    | Atom of ([ `Left |`Right ] * bool * State.t)
+    | Atom of ([ `Left |`Right | `Epsilon ] * bool * State.t)
     | Pred of Tree.Predicate.t
 
 type t
@@ -23,7 +23,7 @@ val is_false : t -> bool
 val true_ : t
 val false_ : t
 val atom_ :
-  [ `Left | `Right ] -> bool -> StateSet.elt -> t
+  [ `Left | `Right | `Epsilon ] -> bool -> StateSet.elt -> t
 val pred_ : Tree.Predicate.t -> t
 val not_ : t -> t
 val or_ : t -> t -> t
@@ -37,7 +37,7 @@ module Infix : sig
   val ( +| ) : t -> t -> t
   val ( *& ) : t -> t -> t
   val ( *+ ) :
-    [ `Left | `Right ] -> StateSet.elt -> t
+    [ `Left | `Right | `Epsilon ] -> StateSet.elt -> t
   val ( *- ) :
-    [ `Left | `Right ] -> StateSet.elt -> t
+    [ `Left | `Right | `Epsilon ] -> StateSet.elt -> t
 end
index c355f5e..e32812b 100644 (file)
@@ -24,6 +24,7 @@ module Make (U : ResJIT.S) : S with type result_set = U.NS.t =
          | Formula.Atom (`Right, b, q) ->
              Formula.of_bool(b == (StateSet.mem q s2)),
              if b && StateSet.mem q auto.topdown_marking_states then [ResJIT.RIGHT q] else []
+         | Formula.Atom (`Epsilon, _, _) -> assert false
 
          | Formula.Or(f1, f2) ->
              let b1, i1 = loop f1 in