Mercurial > projects > dil
diff trunk/src/main.d @ 299:559d5d62e0c1
- Added checks for null before adding member to Node.children.
- Added finishConstruction() to FunctionBody.
author | aziz |
---|---|
date | Thu, 09 Aug 2007 21:39:03 +0000 |
parents | 32d354584b28 |
children | bc1112f7933d |
line wrap: on
line diff
--- a/trunk/src/main.d Thu Aug 09 19:49:03 2007 +0000 +++ b/trunk/src/main.d Thu Aug 09 21:39:03 2007 +0000 @@ -23,13 +23,24 @@ } return result; } - +import Declarations, SyntaxTree; void main(char[][] args) { auto srctext = cast(char[]) std.file.read(args[1]); auto parser = new Parser(srctext, args[1]); parser.start(); auto decls = parser.parseModule(); + +void print(Node[] decls, char[] indent) +{ + foreach(decl; decls) + { + assert(decl !is null); + writefln(indent, decl.classinfo.name, ":", decl.children.length); + print(decl.children, indent ~ " "); + } +} +print(decls, ""); foreach (error; parser.errors) { writefln(`%s(%d)P: %s`, parser.lx.fileName, error.loc, error.getMsg);