# HG changeset patch # User Aziz K?ksal # Date 1200318949 -3600 # Node ID 3bd947eb72c2546fa002fd4a30c7ef88608e537b # Parent be45f982ee3e6c857b0d3c19893fb1e8a26f0731 Added module cmd.ASTStats. diff -r be45f982ee3e -r 3bd947eb72c2 trunk/src/cmd/ASTStats.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/trunk/src/cmd/ASTStats.d Mon Jan 14 14:55:49 2008 +0100 @@ -0,0 +1,22 @@ +/++ + Author: Aziz Köksal + License: GPL3 ++/ +module cmd.ASTStats; + +import dil.ast.DefaultVisitor; +import dil.ast.Node; + +class ASTStats : DefaultVisitor +{ + uint[] table; /// Table for counting nodes. + + uint[] count(Node root) + { + table = new uint[classNames.length]; + super.visitN(root); + return table; + } + + // TODO: add visit methods. +} diff -r be45f982ee3e -r 3bd947eb72c2 trunk/src/cmd/Statistics.d --- a/trunk/src/cmd/Statistics.d Mon Jan 14 14:18:23 2008 +0100 +++ b/trunk/src/cmd/Statistics.d Mon Jan 14 14:55:49 2008 +0100 @@ -3,9 +3,11 @@ License: GPL3 +/ module cmd.Statistics; + import dil.File; import dil.lexer.Lexer; import dil.lexer.Token; +import cmd.ASTStats; import common; struct Statistics diff -r be45f982ee3e -r 3bd947eb72c2 trunk/src/dil/ast/DefaultVisitor.d --- a/trunk/src/dil/ast/DefaultVisitor.d Mon Jan 14 14:18:23 2008 +0100 +++ b/trunk/src/dil/ast/DefaultVisitor.d Mon Jan 14 14:55:49 2008 +0100 @@ -4,6 +4,8 @@ +/ module dil.ast.DefaultVisitor; +import dil.ast.Visitor; + import dil.ast.Node; import dil.ast.Declarations, dil.ast.Expressions,