X-Git-Url: http://git.nguyen.vg/gitweb/?a=blobdiff_plain;f=xPath.ml;fp=xPath.ml;h=27479be6b1925b0906576fcaa67c3b394755e1da;hb=6131f2f9e380543197c9fa253325bbc84749e6e8;hp=4d83634b101a08e5952193881cadeebd94bf98f0;hpb=2f157824afcbbc0852e2ff32ccb3e4dc2100a3b0;p=SXSI%2Fxpathcomp.git diff --git a/xPath.ml b/xPath.ml index 4d83634..27479be 100644 --- a/xPath.ml +++ b/xPath.ml @@ -230,6 +230,7 @@ type config = { st_root : Ata.state; (* state matching the root element (initial mutable entry_points : (Tag.t*Ptset.t) list; mutable contains : string option; mutable univ_states : Ata.state list; + mutable starstate : Ptset.t option; } let dummy_conf = { st_root = -1; st_univ = -1; @@ -242,6 +243,7 @@ let dummy_conf = { st_root = -1; entry_points = []; contains = None; univ_states = []; + starstate = None; } @@ -332,9 +334,11 @@ let rec compile_step ?(existential=false) conf q_src dir ctx_path nrec step num if nrec then `LLeft,`RRight else `Left,`Right in - + let _ = if is_last && axis=Descendant && TagSet.equal test TagSet.star + then conf.starstate <- Some(Ptset.singleton q_src) + in let t1 = ?< q_src><(test, is_last && not(ex))>=> - p_f *& ( if false (*is_last*) then Ata.true_ else (_l left) ** q_dst) in + p_f *& ( if is_last then Ata.true_ else (_l left) ** q_dst) in let _ = add_trans num conf.tr t1 in @@ -503,6 +507,7 @@ let compile path = entry_points = []; contains = None; univ_states = []; + starstate = None; } in let q0 = Ata.mk_state() in @@ -550,6 +555,7 @@ let compile path = Ata.universal = Ptset.add a_dst (Ptset.from_list config.univ_states); Ata.phi = phi; Ata.sigma = Ata.HTagSet.create 17; + Ata.starstate = config.starstate; },config.entry_points,!contains