1 # This file is part of NIT ( http://www.nitlanguage.org ).
3 # Copyright 2004-2008 Jean Privat <jean@pryen.org>
4 # Copyright 2006-2008 Floréal Morandat <morandat@lirmm.fr>
6 # This file is free software, which comes along with NIT. This software is
7 # distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
8 # without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
9 # PARTICULAR PURPOSE. You can modify it is you want, provided this header
10 # is kept unaltered, and a notification of the changes is added.
11 # You are allowed to redistribute it and sell it, alone or is a part of
14 # Exposes methods for debugging ropes when needed.
18 intrude import core
::text
::ropes
21 # Writes self as a dot file on the hard drive
22 private fun internal_to_dot
: String is abstract
24 # Returns the graphviz-formatted content of `self`
26 return "digraph g \{\n" + internal_to_dot + "\}\n"
31 redef fun internal_to_dot
33 var s
= "n{object_id} [label = {length}];\n"
34 s
+= "n{object_id} -> n{left.object_id} [label = \"left\
"];\n"
35 s
+= left
.internal_to_dot
36 s
+= "n{object_id} -> n{right.object_id} [label = \"right\
"];\n"
37 s
+= right
.internal_to_dot
42 redef class FlatString
43 redef fun internal_to_dot
45 return "n{object_id} [label=\"FlatString\\nlength
= {length}\\nbyte_length
= {byte_length}\\nfirst_byte
= {first_byte}\\nlast_byte
= {last_byte}\\nText
= {self.escape_to_dot}\
"];\n"
49 redef class FlatBuffer
50 redef fun internal_to_dot
52 return "n{object_id} [label=\"FlatBuffer\\nbyte_length
= {byte_length}\\nlength
= {length}\\ncapacity
= {capacity}\\nText
= {escape_to_dot}\
"];\n"