X-Git-Url: http://git.nguyen.vg/gitweb/?a=blobdiff_plain;f=src%2Ftree.ml;h=525f8c79f541baf21ce8e2fdc1b49b2c1cb3cfe4;hb=35abea737ead2d4fd121d0cb8bdbda38cfcaa8d3;hp=e06a11e5ff8d6c1a855e82d7f3eb262988515cec;hpb=5b5dcd45cf86701ccfe917c1d6ad73b83bb523c3;p=tatoo.git diff --git a/src/tree.ml b/src/tree.ml index e06a11e..525f8c7 100644 --- a/src/tree.ml +++ b/src/tree.ml @@ -13,16 +13,13 @@ (* *) (***********************************************************************) -(* - Time-stamp: -*) - (** 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 @@ -108,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