Commit 526dd27e authored by Johannes Roith's avatar Johannes Roith

Improve Overview.

parent 988c4162
package de.in.tum.www2.cup.analysis;
import de.in.tum.www2.cup.ast.NonTerminalDeclaration;
import de.in.tum.www2.cup.ast.Production;
import de.in.tum.www2.cup.ast.ProductionRight;
import de.in.tum.www2.cup.ast.TerminalDeclaration;
import de.in.tum.www2.cup.ast.TypedNonTerminalDeclaration;
import de.in.tum.www2.cup.ast.TypedTerminalDeclaration;
public class StatisticsVisitor extends Visitor<Object>
{
private int terminalCount;
private int nonTerminalCount;
private int productionCount;
private int productionRightCount;
public int getTerminalCount() {
return terminalCount;
}
public int getNonTerminalCount() {
return nonTerminalCount;
}
public int getProductionCount() {
return productionCount;
}
public int getProductionRightCount() {
return productionRightCount;
}
@Override
public void postVisit (TerminalDeclaration node, Object data) {
if (node.getTerminals() != null)
terminalCount += node.getTerminals().size();
}
@Override
public void postVisit (TypedTerminalDeclaration node, Object data) {
if (node.getTerminals() != null)
terminalCount += node.getTerminals().size();
}
@Override
public void postVisit (NonTerminalDeclaration node, Object data) {
if (node.getNonTerminals() != null)
nonTerminalCount += node.getNonTerminals().size();
}
@Override
public void postVisit (TypedNonTerminalDeclaration node, Object data) {
if (node.getNonTerminals() != null)
nonTerminalCount += node.getNonTerminals().size();
}
@Override
public void postVisit (Production node, Object data) {
productionCount++;
}
@Override
public void postVisit (ProductionRight node, Object data) {
productionRightCount++;
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment