let compare = compare_node end)
end
-let is_nil t = match t.node with
- | Nil -> true
- | Node(i) -> equal_node i nil
- | _ -> false
-
-let is_node t =
-match t.node with
- | Node(i) -> not(equal_node i nil)
- | _ -> false
+let is_nil t = t.node == Nil
+let is_node t = t.node != Nil
let node_of_t t =
let _ = Tag.init (Obj.magic t) in
let equal a b = (compare a b) == 0
-let norm (n : [`Tree ] node ) = if tree_is_nil n then Nil else Node (n)
+let norm (n : [`Tree ] node ) = if n == -1 then Nil else Node (n)
let nts = function
Nil -> "Nil"
| Node i -> { n with node= norm(tree_next_sibling n.doc i) }
| _ -> { n with node = Nil }
-let node_sibling_ctx n _ =
+let node_sibling_ctx n _ =
match n.node with
| Node i -> { n with node= norm(tree_next_sibling n.doc i) }
| _ -> { n with node = Nil }
| Nil -> ()
| Text(i,n) -> output_string outc (text_get_text t.doc i);
if print_right
- then loop (left t)
+ then loop (right t)
| Node (n) ->
let tg = Tag.to_string (tag t) in
let l = left t