summaryrefslogtreecommitdiff
path: root/src/util.ml
diff options
context:
space:
mode:
authorDaniil Baturin <daniil@baturin.org>2015-04-23 09:01:00 +0600
committerDaniil Baturin <daniil@baturin.org>2015-04-23 09:01:00 +0600
commita15396525e442acc76cca061e0cbe1bc98af83d0 (patch)
tree9883e353c2b2d02d5f8c1251dc4652f4c04f61e3 /src/util.ml
parent187d282353d74d185d4b1bbe4ce69bc1b2948aa9 (diff)
downloadvyconf-a15396525e442acc76cca061e0cbe1bc98af83d0.tar.gz
vyconf-a15396525e442acc76cca061e0cbe1bc98af83d0.zip
Quick and dirty path pretty printer.
Diffstat (limited to 'src/util.ml')
-rw-r--r--src/util.ml11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/util.ml b/src/util.ml
index 33c90a2..141d25b 100644
--- a/src/util.ml
+++ b/src/util.ml
@@ -9,3 +9,14 @@ let find_xml_child name xml =
match xml with
| Xml.Element (_, _, children) -> List.find find_aux children
| Xml.PCData _ -> raise Not_found
+
+(* Dirty pretty printer *)
+let string_of_path path =
+ let rec aux xs acc =
+ match xs with
+ | [] -> acc
+ | x :: xs' -> aux xs' (Printf.sprintf "%s %s" acc x)
+ in
+ match path with
+ | [] -> "[]"
+ | x :: xs -> Printf.sprintf "[%s%s]" x (aux xs "")