Initial public import
[afterthought.git] / aft_types.ml
1 open Xpath_ext
2 open Xpath_syntax
3 open Printf
4 open Globals
5
6 let rec pretty_print_xpath_path xpath_path = 
7   match xpath_path with 
8     | Pipe(e1,e2) ->  (*Slash(_,Expr(String_literal(se))) ->*)
9         (*sprintf "%s.x" se *)
10         let s1 = pretty_print_xpath_path e1 in
11         let s2 = pretty_print_xpath_path e2 in
12           sprintf "%s|%s" s1 s2
13     | Slash(e1,e2) ->
14         let s1 = pretty_print_xpath_path e1 in
15         let s2 = pretty_print_xpath_path e2 in
16           sprintf "%s/%s" s1 s2
17     | Condition(e,expr) ->
18         let s = pretty_print_xpath_path e in
19           sprintf "%s[cond]" s
20     | Root ->
21         ""
22     | Axis(_,e)->
23         pretty_print_xpath_path e
24     | Name(s)->
25         s
26     | _ -> raise AftError
27
28
29 type access_spec = Filter of expr | INF of inf | PatternMatch of pattern_match
30     and right_clause = True of access_spec 
31     and left_clause = False of access_spec 
32     and inf = path_expr * right_clause * left_clause
33     and clause = Clause of path_expr * access_spec
34     and pattern_match = clause list