(***********************************************************************) (* *) (* TAToo *) (* *) (* Lucca Hirschi, ? *) (* ? *) (* *) (* Copyright 2010-2012 Université Paris-Sud and Centre National de la *) (* Recherche Scientifique. All rights reserved. This file is *) (* distributed under the terms of the GNU Lesser General Public *) (* License, with the special exception on linking described in file *) (* ../LICENSE. *) (* *) (***********************************************************************) open XPath.Ast open Formula.Infix exception Not_core_XPath of path (** Raised whenever the XPath query contains not implemented structures *) let trans query = let asta = Asta.empty in let rec trans = function | [s] -> trans_last s | s :: tl -> trans_step s; trans tl | [] -> () and trans_init () = (* add THE top state *) let top_st = Asta.new_state () in let or_top = List.fold_left (fun acc x -> (`Left *+ x +| acc)) Formula.true_ (Asta.top_states asta) in Asta.add_tr asta (top_st, Asta.any_label, or_top) and trans_last (ax,test,pred) = (* a selecting state is needed *) () and trans_step (ax,test,pred) = () and trans_pr p = () in match query with | Absolute steps -> trans_init(); trans steps; asta | AbsoluteDoS steps as x -> raise (Not_core_XPath x) | Relative steps as x -> raise (Not_core_XPath x)