X-Git-Url: http://git.nguyen.vg/gitweb/?p=tatoo.git;a=blobdiff_plain;f=src%2Ftree%2Fnaive.ml;h=fa14d937eb1ef30eb55a466cee4866101ab6d8d7;hp=0885bad88aee35ee063c9c39677102f9cae39089;hb=9b3611f8b650edf4183169a9c2c4317e13be536d;hpb=738218592e41da4ceb46f4dba41f292a60ba1f7b diff --git a/src/tree/naive.ml b/src/tree/naive.ml index 0885bad..fa14d93 100644 --- a/src/tree/naive.ml +++ b/src/tree/naive.ml @@ -14,7 +14,7 @@ (***********************************************************************) (* - Time-stamp: + Time-stamp: *) open Utils @@ -54,6 +54,7 @@ let rec dummy = { type t = { root : node; + size : int; (* TODO add other intersting stuff *) } @@ -211,7 +212,9 @@ struct match ctx.stack with [ root ] -> root.next_sibling <- nil; - { root = root } + { root = root; + size = ctx.current_preorder + } | _ -> raise (Expat.Expat_error Expat.UNCLOSED_TOKEN) ) @@ -299,6 +302,7 @@ let print_xml out tree_ node = let nnode = { node with next_sibling = nil } in print_xml out tree_ nnode let root t = t.root +let size t = t.size let first_child _ n = n.first_child let next_sibling _ n = n.next_sibling let parent _ n = n.parent