projects
/
SXSI
/
xpathcomp.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Restored bottom up run
[SXSI/xpathcomp.git]
/
tag.ml
diff --git
a/tag.ml
b/tag.ml
index
057f09d
..
f9c0275
100644
(file)
--- a/
tag.ml
+++ b/
tag.ml
@@
-17,8
+17,11
@@
external tag_name : pool -> t -> string = "caml_xml_tree_tag_name"
let nullt = null_tag ()
(* Defined in XMLTree.cpp *)
let nullt = null_tag ()
(* Defined in XMLTree.cpp *)
-let pcdata = 1
-let attribute = 0
+let document_node = 0
+let attribute = 1
+let pcdata = 2
+let attribute_data= 3
+
let pool = Weak.create 1
let pool = Weak.create 1
@@
-31,14
+34,29
@@
let get_pool () = match Weak.get pool 0 with
let tag s = match s with
| "<$>" -> pcdata
| "<@>" -> attribute
let tag s = match s with
| "<$>" -> pcdata
| "<@>" -> attribute
+ | "" -> document_node
+ | "<@$>" -> attribute_data
| _ -> register_tag (get_pool()) s
let compare = (-)
let equal = (==)
| _ -> register_tag (get_pool()) s
let compare = (-)
let equal = (==)
+
+let hash x = x
+
+
let to_string t =
let to_string t =
- if t = pcdata then "<$>"
- else if t = attribute then "<@>"
+ if t == pcdata then "<$>"
+ else if t == attribute_data then "<@$>"
+ else if t == attribute then "<@>"
+ else if t == nullt then "<!NIL!>"
else tag_name (get_pool()) t
let print ppf t = Format.fprintf ppf "%s" (to_string t)
else tag_name (get_pool()) t
let print ppf t = Format.fprintf ppf "%s" (to_string t)
+(* Check internal invariants *)
+let check t =
+ if (t != tag (to_string t))
+ then failwith "module Tag: internal check failed"
+
+let dump = print
+