X-Git-Url: http://git.nguyen.vg/gitweb/?p=tatoo.git;a=blobdiff_plain;f=src%2Fcompil.ml;h=574485e00285cfc80fe5c4ecbb32fa9315155298;hp=1ac98e2e16429f45ca0a46d18bbaf3f8b8ca9a79;hb=09cd270a1d9d1405795aa3d220267bc3141dd0bd;hpb=d0dc6fbd661c7a79a2d8f875a204f587e6a5162d diff --git a/src/compil.ml b/src/compil.ml index 1ac98e2..574485e 100644 --- a/src/compil.ml +++ b/src/compil.ml @@ -30,12 +30,12 @@ let trans query = | [s] -> trans_last s | s :: tl -> trans tl; trans_step s | [] -> () - + (* Add THE top most state for top-level query (done in the end) *) and trans_init () = let top_st = Asta.new_state () in let or_top = - List.fold_left (fun acc x -> ((`Left *+ x) +| acc)) + List.fold_left (fun acc x -> ((`Left *+ x) +| acc)) (Formula.false_) (Asta.top_states asta) in Asta.add_quer asta top_st; @@ -43,7 +43,7 @@ let trans query = Asta.add_top asta top_st; Asta.add_bot asta top_st; (* for trees which are leaves *) Asta.add_tr asta (top_st, Asta.any_label, or_top) true - + (* A selecting state is needed *) and trans_last (ax,test,pred) = let fo_p = trans_pr pred in @@ -59,7 +59,7 @@ let trans query = and tr_q = (q, Asta.any_label, form_propa_selec q q' ax) in Asta.add_tr asta tr_selec true; Asta.add_tr asta tr_q true - + (* Add a new state and its transitions for the step *) and trans_step (ax,test,pred) = let fo_p = trans_pr pred @@ -67,7 +67,7 @@ let trans query = 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 + 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; @@ -77,7 +77,7 @@ let trans query = Asta.add_tr asta tr_propa true; Asta.init_top asta; Asta.add_top asta q - + (* Translating of predicates. Either we apply De Morgan rules in xPath.parse or here *) and trans_pr = function @@ -88,7 +88,7 @@ let trans query = | Not (Expr Path q) -> (trans_pr_path false q) | Expr Path q -> (trans_pr_path true q) | x -> print_predicate pr_er x; raise Not_core_XPath - + (* Builds asta for predicate and gives the formula which must be satsified *) and trans_pr_path posi = function | Relative [] -> if posi then Formula.true_ else Formula.false_ @@ -97,7 +97,7 @@ let trans query = Formula.false_ (trans_pr_step_l steps) | AbsoluteDoS steps as x -> print pr_er x; raise Not_core_XPath | Absolute steps as x -> print pr_er x; raise Not_core_XPath - + (* Builds asta for a predicate query and give the formula *) and trans_pr_step_l = function | [step] -> trans_pr_step [] step