comparison tools/DotPrinter.d @ 94:48bb2287c035 new_gen

Added Modules. Right now it's very simple - will grow with time and need.
author Anders Johnsen <skabet@gmail.com>
date Tue, 06 May 2008 16:24:14 +0200
parents eb5b2c719a39
children
comparison
equal deleted inserted replaced
93:621cedba53ea 94:48bb2287c035
1 module tools.DotPrinter; 1 module tools.DotPrinter;
2 2
3 import tango.io.Stdout, 3 import tango.io.Stdout,
4 Int = tango.text.convert.Integer; 4 Int = tango.text.convert.Integer;
5 5
6 import ast.Decl, 6 import ast.Module,
7 ast.Decl,
7 ast.Stmt, 8 ast.Stmt,
8 ast.Exp; 9 ast.Exp;
9 10
10 class DotPrinter 11 class DotPrinter
11 { 12 {
14 } 15 }
15 16
16 private char[][void*] identifiers; 17 private char[][void*] identifiers;
17 private int current_id = 0; 18 private int current_id = 0;
18 19
19 void print(Decl[] decls) 20 void print(Module m)
20 { 21 {
21 Stdout("digraph {").newline; 22 Stdout("digraph {").newline;
22 foreach(decl ; decls) 23 foreach(decl ; m.decls)
23 { 24 {
24 printDecl(decl); 25 printDecl(decl);
25 } 26 }
26 Stdout("}").newline; 27 Stdout("}").newline;
27 } 28 }