X-Git-Url: http://git.nguyen.vg/gitweb/?p=tatoo.git;a=blobdiff_plain;f=src%2Fxpath%2Fcompile.ml;h=7848b84ffec7407381836da1f33a571b4c3cd049;hp=1c46b8f93b42f8154c475c87295c9b52793b67df;hb=9d83bf3832f03462a5d1f451d96e8d30347bf363;hpb=38cbd62f27eb7e1f461bc764cc89366557ec0124 diff --git a/src/xpath/compile.ml b/src/xpath/compile.ml index 1c46b8f..7848b84 100644 --- a/src/xpath/compile.ml +++ b/src/xpath/compile.ml @@ -14,7 +14,7 @@ (***********************************************************************) (* - Time-stamp: + Time-stamp: *) open Ast @@ -70,12 +70,20 @@ let compile_axis_test ?(block_attr=true) axis test phi trans states = QNameSet.any => F.next_sibling q ]) :: trans, states) - | Descendant self -> - ((if self then F.stay q else F.first_child q), + | Descendant false -> + (F.first_child q, (q, [ test => phi %% phi_attr; QNameSet.any => F.first_child q ++ F.next_sibling q; ]) :: trans, states) + | Descendant true -> + let q' = State.make () in + (F.or_ (F.stay q) (F.first_child q'), + (q', [ test => phi %% phi_attr; + QNameSet.any => F.first_child q' ++ F.next_sibling q'; + ]):: + (q, [ test => phi %% phi_attr]):: trans, + states) | Parent -> let q' = State.make () in