Rewrite the AST to conform to the W3C grammar
[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 = single_path list
22   and single_path = Absolute of step list | Relative of step list
23   and step = axis * test * expr list
24   and axis = Self | Attribute | Child | Descendant | DescendantOrSelf | FollowingSibling
25              | Parent | Ancestor | AncestorOrSelf | PrecedingSibling | Preceding | Following
26
27   and test = Simple of QNameSet.t
28
29   and binop = Eq | Neq | Lt | Gt | Lte | Gte | Or | And | Add | Sub | Mult | Div | Mod
30   and unop =  Neg
31   and expr =
32     | Number of [ `Int of int | `Float of float ]
33     | String of string
34     | Fun_call of QName.t * expr list
35     | Path of path
36     | Binop of expr * binop * expr
37     | Unop of unop * expr
38
39
40   type t = path
41 end