module Ast =
struct
- type path = Absolute of step list | AbsoluteDoS of step list| Relative of step list
+ type path = Absolute of step list | Relative of step list
and step = axis * test *predicate
and axis = Self | Attribute | Child | Descendant | DescendantOrSelf | FollowingSibling
| Parent | Ancestor | AncestorOrSelf | PrecedingSibling | Preceding | Following
let rec print fmt p =
let l = match p with
| Absolute l -> pp fmt "/"; l
- | AbsoluteDoS l -> pp fmt "/";
- print_step fmt (DescendantOrSelf,Simple QNameSet.any,Expr True);
- pp fmt "/"; l
| Relative l -> l
in
Pretty.print_list ~sep:"/" print_step fmt l
print_axis r a; Format.flush_str_formatter()
-
-
EXTEND Gram
GLOBAL: query;
;
path : [
- [ "//" ; l = slist -> AbsoluteDoS (List.rev l) ]
- | [ "/" ; l = slist -> Absolute (List.rev l) ]
+ [ "/" ; l = slist -> Absolute (List.rev l) ]
| [ l = slist -> Relative (List.rev l) ]
]
;
| Some(t) -> (axis,t,p)
| None -> (Child,Simple (QNameSet.singleton (QName.of_string (axis_to_string axis))),p)
in match a with
- | Following -> [ (DescendantOrSelf,t,p);
- (FollowingSibling, t_star,Expr(True));
+ | Following -> [ (DescendantOrSelf,t,p);
+ (FollowingSibling, t_star,Expr(True));
(Ancestor, t_star ,Expr(True)) ]
| Preceding -> [ (DescendantOrSelf,t,p);