afb4c39e8bf5bfb895bf981bd00e5ee9e3ebef08
[tatoo.git] / src / xPath.mli
1 (***********************************************************************)
2 (*                                                                     *)
3 (*                               TAToo                                 *)
4 (*                                                                     *)
5 (*                     Kim Nguyen, LRI UMR8623                         *)
6 (*                   Université Paris-Sud & CNRS                       *)
7 (*                                                                     *)
8 (*  Copyright 2010-2012 Université Paris-Sud and Centre National de la *)
9 (*  Recherche Scientifique. All rights reserved.  This file is         *)
10 (*  distributed under the terms of the GNU Lesser General Public       *)
11 (*  License, with the special exception on linking described in file   *)
12 (*  ../LICENSE.                                                        *)
13 (*                                                                     *)
14 (***********************************************************************)
15
16
17 (** Abstract syntax tree of XPath queries *)
18
19 module Ast :
20 sig
21   type path = Absolute of step list | AbsoluteDoS of step list
22               | Relative of step list
23
24   and step = axis * test * predicate
25   and axis = Self | Attribute | Child | Descendant | DescendantOrSelf
26              | FollowingSibling
27              | Parent | Ancestor | AncestorOrSelf |PrecedingSibling
28              | Preceding | Following
29   and test =  Simple of QNameSet.t
30   and predicate = Or of predicate*predicate
31                   | And of predicate*predicate
32                   | Not of predicate
33                   | Expr of expression
34   and expression =  Path of path
35                     | Function of string*expression list
36                     | Int of int
37                     | String of string
38                     | True | False
39   type t = path
40   val print : Format.formatter -> path -> unit
41   val print_step : Format.formatter -> step -> unit
42   val print_axis : Format.formatter -> axis -> unit
43   val print_test : Format.formatter -> test -> unit
44   val print_predicate : Format.formatter -> predicate -> unit
45   val print_expression : Format.formatter -> expression -> unit
46 end
47
48
49 val parse_string : string -> Ast.path
50 val parse_file : in_channel -> Ast.path