Refactor HTML Tracing to not depend on external files (style, javascript). Add a...
[tatoo.git] / src / tree.ml
index 9ef78ce..525f8c7 100644 (file)
 (*                                                                     *)
 (***********************************************************************)
 
-(*
-  Time-stamp: <Last modified on 2013-04-04 18:40:39 CEST by Kim Nguyen>
-*)
-
 (** The different kind of XML nodes and utility functions *)
 
 module NodeKind =
   struct
     type t =
-        Document | Element | Text | Comment | Attribute | ProcessingInstruction | Node
+      Document | Element | Text | Comment | Attribute
+    | ProcessingInstruction | Node
 
     let to_string =
       function
@@ -41,9 +38,10 @@ module NodeKind =
       k1 == Node || k2 == Node || k1 == k2
 end
 
-
 (** Signatures for trees *)
 
+exception Parse_error of string
+
 module type S =
 sig
   type node
@@ -107,9 +105,12 @@ sig
   (** Returns the kind of the given node *)
 
   val preorder : t -> node -> int
-  (** Returns the position of a node in pre-order in the tree. The
-    root has preorder 0. [nil] has pre-order [-1].
+  (** [preorder t n] returns the pre-order position of [n] in [t].
+      [preodrder t (root t) == 0] and [preorder t nil < 0].
   *)
 
+  val by_preorder : t -> int -> node
+  (** [by_preorder t i] returns the node with preorder [i]
+  *)
   val print_node : Format.formatter -> node -> unit
 end