1 |
3
|
krennw
|
<?xml version="1.0"?>
|
2 |
|
|
<doc>
|
3 |
|
|
<assembly>
|
4 |
|
|
<name>Antlr3.Utility</name>
|
5 |
|
|
</assembly>
|
6 |
|
|
<members>
|
7 |
|
|
<member name="T:Antlr.Utility.Tree.DOTTreeGenerator">
|
8 |
|
|
<summary>
|
9 |
|
|
A utility class to generate DOT diagrams (graphviz) from
|
10 |
|
|
arbitrary trees. You can pass in your own templates and
|
11 |
|
|
can pass in any kind of tree or use Tree interface method.
|
12 |
|
|
I wanted this separator so that you don't have to include
|
13 |
|
|
ST just to use the org.antlr.runtime.tree.* package.
|
14 |
|
|
This is a set of non-static methods so you can subclass
|
15 |
|
|
to override. For example, here is an invocation:
|
16 |
|
|
|
17 |
|
|
CharStream input = new ANTLRInputStream(Console.In);
|
18 |
|
|
TLexer lex = new TLexer(input);
|
19 |
|
|
CommonTokenStream tokens = new CommonTokenStream(lex);
|
20 |
|
|
TParser parser = new TParser(tokens);
|
21 |
|
|
TParser.e_return r = parser.e();
|
22 |
|
|
Tree t = (Tree)r.tree;
|
23 |
|
|
Console.Out.WriteLine(t.ToStringTree());
|
24 |
|
|
DOTTreeGenerator gen = new DOTTreeGenerator();
|
25 |
|
|
StringTemplate st = gen.ToDOT(t);
|
26 |
|
|
Console.Out.WriteLine(st);
|
27 |
|
|
|
28 |
|
|
</summary>
|
29 |
|
|
</member>
|
30 |
|
|
<member name="F:Antlr.Utility.Tree.DOTTreeGenerator.nodeToNumberMap">
|
31 |
|
|
<summary>
|
32 |
|
|
Track node to number mapping so we can get proper node name back
|
33 |
|
|
</summary>
|
34 |
|
|
</member>
|
35 |
|
|
<member name="F:Antlr.Utility.Tree.DOTTreeGenerator.nodeNumber">
|
36 |
|
|
<summary>
|
37 |
|
|
Track node number so we can get unique node names
|
38 |
|
|
</summary>
|
39 |
|
|
</member>
|
40 |
|
|
<member name="M:Antlr.Utility.Tree.DOTTreeGenerator.ToDOT(Antlr.Runtime.Tree.ITree)">
|
41 |
|
|
<summary>
|
42 |
|
|
Generate DOT (graphviz) for a whole tree not just a node.
|
43 |
|
|
For example, 3+4*5 should generate:
|
44 |
|
|
|
45 |
|
|
digraph {
|
46 |
|
|
node [shape=plaintext, fixedsize=true, fontsize=11, fontname="Courier",
|
47 |
|
|
width=.4, height=.2];
|
48 |
|
|
edge [arrowsize=.7]
|
49 |
|
|
"+"->3
|
50 |
|
|
"+"->"*"
|
51 |
|
|
"*"->4
|
52 |
|
|
"*"->5
|
53 |
|
|
}
|
54 |
|
|
|
55 |
|
|
Return the ST not a string in case people want to alter.
|
56 |
|
|
|
57 |
|
|
Takes a Tree interface object.
|
58 |
|
|
</summary>
|
59 |
|
|
</member>
|
60 |
|
|
</members>
|
61 |
|
|
</doc> |