projects
/
tatoo.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Remove AbsoluteDOS from the XPath AST.
[tatoo.git]
/
src
/
xPath.ml
diff --git
a/src/xPath.ml
b/src/xPath.ml
index
cb3393f
..
5258b67
100644
(file)
--- a/
src/xPath.ml
+++ b/
src/xPath.ml
@@
-17,7
+17,7
@@
module Ast =
struct
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
and step = axis * test *predicate
and axis = Self | Attribute | Child | Descendant | DescendantOrSelf | FollowingSibling
| Parent | Ancestor | AncestorOrSelf | PrecedingSibling | Preceding | Following
@@
-62,9
+62,6
@@
struct
let rec print fmt p =
let l = match p with
| Absolute l -> pp fmt "/"; l
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
| Relative l -> l
in
Pretty.print_list ~sep:"/" print_step fmt l
@@
-139,8
+136,6
@@
struct
print_axis r a; Format.flush_str_formatter()
print_axis r a; Format.flush_str_formatter()
-
-
EXTEND Gram
GLOBAL: query;
EXTEND Gram
GLOBAL: query;
@@
-149,8
+144,7
@@
GLOBAL: query;
;
path : [
;
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) ]
]
;
| [ l = slist -> Relative (List.rev l) ]
]
;
@@
-174,8
+168,8
@@
step : [
| Some(t) -> (axis,t,p)
| None -> (Child,Simple (QNameSet.singleton (QName.of_string (axis_to_string axis))),p)
in match a with
| 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);
(Ancestor, t_star ,Expr(True)) ]
| Preceding -> [ (DescendantOrSelf,t,p);
@@
-366,6
+360,9
@@
END
*)
*)
- let parse = Gram.parse_string query (Ulexer.Loc.mk "<string>")
+ let parse_string = Gram.parse_string query (Ulexer.Loc.mk "<string>")
+ let parse_file fd = parse_string (input_line fd)
+
end
end
-let parse = Parser.parse
+let parse_string = Parser.parse_string
+let parse_file = Parser.parse_file