First implementation of compilation from XPath to automata using
[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 (*
17   Time-stamp: <Last modified on 2013-03-04 16:24:33 CET by Kim Nguyen>
18 *)
19
20 type path = single_path list
21 and single_path = Absolute of step list | Relative of step list
22 and step = axis * test * expr list
23 and axis = Self | Attribute | Child
24            | Descendant of bool
25            | FollowingSibling
26            | Parent
27            | Ancestor of bool
28            | PrecedingSibling
29            | Preceding | Following
30
31 and test = Utils.QNameSet.t
32
33 and binop = Eq | Neq | Lt | Gt | Lte | Gte | Or | And | Add | Sub | Mult | Div | Mod
34 and unop =  Neg
35 and expr =
36   | Number of [ `Int of int | `Float of float ]
37   | String of string
38   | Fun_call of Utils.QName.t * expr list
39   | Path of path
40   | Binop of expr * binop * expr
41   | Unop of unop * expr
42 type t = path
43 val text : Utils.QNameSet.t
44 val node : Utils.QNameSet.t
45 val star : Utils.QNameSet.t
46 val print_binop : Format.formatter -> binop -> unit
47 val print_unop : Format.formatter -> unop -> unit
48 val print_path : Format.formatter -> path -> unit
49 val print_single_path : Format.formatter -> single_path -> unit
50 val print_step : Format.formatter -> step -> unit
51 val print_axis : Format.formatter -> axis -> unit
52 val print_test : Format.formatter -> test -> unit
53 val print_expr : Format.formatter -> expr -> unit
54
55 val invert_axis : axis -> axis