From: Lucca Hirschi Date: Tue, 3 Jul 2012 08:35:32 +0000 (+0200) Subject: XPath without predicates are correctly compiled. X-Git-Tag: Core~17 X-Git-Url: http://git.nguyen.vg/gitweb/?p=tatoo.git;a=commitdiff_plain;h=a3db3281c936a50107f9e73ec06c3a6171d61dbd XPath without predicates are correctly compiled. --- diff --git a/src/compil.ml b/src/compil.ml index 8044968..b722656 100644 --- a/src/compil.ml +++ b/src/compil.ml @@ -27,7 +27,7 @@ let trans query = step. Then add a top most state. Each function modifies asta. *) let rec trans = function | [s] -> trans_last s - | s :: tl -> trans_step s; trans tl + | s :: tl -> trans tl; trans_step s | [] -> () and trans_init () = (* add THE top most state *) @@ -58,7 +58,21 @@ let trans query = Asta.add_tr asta tr_q and trans_step (ax,test,pred) = - () + let fo_p = trans_pr pred + and q = Asta.new_state() in + let Simple label = test + and form_next = (fo_p) *& (* (\/ top_next) /\ predicat *) + (List.fold_left (fun acc x -> (`Left *+ x ) +| acc) + Formula.false_ (Asta.top_states asta)) in + let tr_next = (q, label, form_next) + and tr_propa = (q, Asta.any_label, form_propa q ax) in + Asta.add_quer asta q; + Asta.add_top asta q; + Asta.add_bot asta q; + Asta.add_tr asta tr_next; + Asta.add_tr asta tr_propa; + Asta.init_top asta; + Asta.add_top asta q and trans_pr = function (* either we apply De Morgan rules in xPath:parse or here *)