X-Git-Url: http://git.nguyen.vg/gitweb/?p=tatoo.git;a=blobdiff_plain;f=src%2Fxpath%2Fcompile.ml;fp=src%2Fxpath%2Fcompile.ml;h=e8ab6fc47609151c9741f7dac336052cc83341ee;hp=1bfe292feb58284d87974a41db6419f50b1e7c95;hb=8c4a23b0bb5883174e225e16d0ac9e5fe2c13032;hpb=c6f23a2c3a5c0ee4426d1b00fc2807676abdf132 diff --git a/src/xpath/compile.ml b/src/xpath/compile.ml index 1bfe292..e8ab6fc 100644 --- a/src/xpath/compile.ml +++ b/src/xpath/compile.ml @@ -66,11 +66,10 @@ let compile_axis_test axis (test,kind) phi trans states = states) | Descendant true -> let q' = State.make () in - (F.or_ (F.stay q) (F.first_child q'), - (q', [ test => phi; - QNameSet.any => F.first_child q' ++ F.next_sibling q'; - ]):: - (q, [ test => phi]):: trans, + (F.stay q ++ F.first_child q', + (q', [ QNameSet.any => F.stay q ++ F.first_child q' ++ F.next_sibling q'; + ]):: + (q, [ test => phi]):: trans, states) | Parent -> @@ -82,13 +81,12 @@ let compile_axis_test axis (test,kind) phi trans states = (q' @: states)) | Ancestor self -> - let q' = State.make () in - let move = F.parent q ++ F.previous_sibling q' in - (if self then F.stay q else move), - (q, [ test => phi; - QNameSet.any => move ]) - :: (q', [ QNameSet.any => move ]) :: trans, - (q' @: states) + let q' = State.make () 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]) + :: (q, [ test => phi ]) :: trans, + (q' @: states) | FollowingSibling | PrecedingSibling -> let move =