Ajout des fonctions is_next_sibling, is_first_child, prev_sibling et parent_of_first
[tatoo.git] / src / tree.ml
index 97711dd..9e6c71c 100644 (file)
@@ -18,7 +18,8 @@
 module NodeKind =
   struct
     type t =
-        Document | Element | Text | Comment | Attribute | ProcessingInstruction | Node
+      Document | Element | Text | Comment | Attribute
+    | ProcessingInstruction | Node
 
     let to_string =
       function
@@ -112,4 +113,15 @@ sig
   (** [by_preorder t i] returns the node with preorder [i]
   *)
   val print_node : Format.formatter -> node -> unit
+
+  val is_first_child : t -> node -> bool
+  val is_next_sibling : t -> node -> bool
+  val prev_sibling : t -> node -> node
+ (** [prev_sibling t n] returns the previous_sibling of node [n] in tree [t].
+      Returns [nil] if [n] is the first child of a node.
+  *)
+  val parent_of_first : t -> node -> node
+ (** [parent_of_first t n] returns the parent of node [n] in tree [t] .
+      Returns [nil] if [n] isn't the first child of a node.
+  *)
 end