Initial commit
[SXSI/xpathcomp.git] / xPath.mli
1 (******************************************************************************)
2 (*  SXSI : XPath evaluator                                                    *)
3 (*  Kim Nguyen (Kim.Nguyen@nicta.com.au)                                      *)
4 (*  Copyright NICTA 2008                                                      *)
5 (*  Distributed under the terms of the LGPL (see LICENCE)                     *)
6 (******************************************************************************)
7 module Ast :
8   sig
9     type path = Absolute of step list | AbsoluteDoS of step list| Relative of step list
10     and step = axis * test * predicate
11     and axis = Self | Attribute | Child | Descendant | DescendantOrSelf | FollowingSibling
12            | Parent
13     and test = TagSet.Xml.t
14     and predicate = Or of predicate*predicate
15                     | And of predicate*predicate
16                     | Not of predicate  
17                     | Expr of expression
18     and expression =  Path of path
19                       | Function of string*expression list
20                       | Int of int
21                       | String of string
22                       | True | False
23     type t = path
24     val print : Format.formatter -> path -> unit
25     val print_step : Format.formatter -> step -> unit
26     val print_axis : Format.formatter -> axis -> unit
27     val print_test : Format.formatter -> test -> unit
28     val print_predicate : Format.formatter -> predicate -> unit
29     val print_expression : Format.formatter -> expression -> unit
30   end
31 module Parser :
32   sig
33     val parse_string : string -> Ast.path
34     val parse : string -> Ast.path
35   end
36 module Compile :
37 sig
38   val compile : Ast.path -> Automaton.t
39 end