: comment.substring(2);
}
});
/* Functions */
builder.withSquidAstVisitor(new SourceCodeBuilderVisitor<Grammar>(new SourceCodeBuilderCallback() {
public SourceCode createSourceCode(SourceCode parentSourceCode, AstNode astNode) {
StringBuilder sb = new StringBuilder();
for (Token token : astNode.getFirstDescendant(CxxGrammarImpl.declaratorId).getTokens()) {
sb.append(token.getValue());
}
String functionName = sb.toString();
SourceFunction function = new SourceFunction(functionName + ":" + astNode.getToken().getLine());
function.setStartAtLine(astNode.getTokenLine());
return function;
}
}, CxxGrammarImpl.functionDefinition));
builder.withSquidAstVisitor(CounterVisitor.<Grammar> builder()
.setMetricDef(CxxMetric.FUNCTIONS)
.subscribeTo(CxxGrammarImpl.functionDefinition)
.build());
/* Classes */
builder.withSquidAstVisitor(new SourceCodeBuilderVisitor<Grammar>(new SourceCodeBuilderCallback() {
public SourceCode createSourceCode(SourceCode parentSourceCode, AstNode astNode) {
AstNode classNameAst = astNode.getFirstDescendant(CxxGrammarImpl.className);
String className = classNameAst == null ? "" : classNameAst.getFirstChild().getTokenValue();
SourceClass cls = new SourceClass(className + ":" + astNode.getToken().getLine(), className);
cls.setStartAtLine(astNode.getTokenLine());