Add a new option to choose tree model at runtime.
[tatoo.git] / src / xpath / ast.mli
1 (***********************************************************************)
2 (*                                                                     *)
3 (*                               TAToo                                 *)
4 (*                                                                     *)
5 (*                     Kim Nguyen, LRI UMR8623                         *)
6 (*                   Université Paris-Sud & CNRS                       *)
7 (*                                                                     *)
8 (*  Copyright 2010-2013 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 type path = single_path list
17     (* the step are given in reverse with the last step of the query
18        being the first of the step list *)
19 and single_path = Absolute of step list | Relative of step list
20 and step = axis * test * expr list
21 and axis = Self | Attribute | Child
22            | Descendant of bool
23            | FollowingSibling
24            | Parent
25            | Ancestor of bool
26            | PrecedingSibling
27            | Preceding | Following
28
29 and test = QNameSet.t * Tree.NodeKind.t
30
31 and binop = Eq | Neq | Lt | Gt | Lte | Gte | Or | And | Add | Sub | Mult | Div | Mod
32 and unop =  Neg
33 and expr =
34   | Number of [ `Int of int | `Float of float ]
35   | String of string
36   | Fun_call of QName.t * expr list
37   | Path of path
38   | Binop of expr * binop * expr
39   | Unop of unop * expr
40 type t = path
41 val text : QNameSet.t
42 val node : QNameSet.t
43 val star : QNameSet.t
44 val print_binop : Format.formatter -> binop -> unit
45 val print_unop : Format.formatter -> unop -> unit
46 val print_path : Format.formatter -> path -> unit
47 val print_single_path : Format.formatter -> single_path -> unit
48 val print_step : Format.formatter -> step -> unit
49 val print_axis : Format.formatter -> axis -> unit
50 val print_test : Format.formatter -> test -> unit
51 val print_expr : Format.formatter -> expr -> unit
52
53 val invert_axis : axis -> axis