/** Listen to matches of methodDeclaration */ @Override public void enterMethodDeclaration(JavaParser.MethodDeclarationContext ctx) { // need parser to get tokens TokenStream tokens = parser.getTokenStream(); String type = "void"; if (ctx.type() != null) { type = tokens.getText(ctx.type()); } String args = tokens.getText(ctx.formalParameters()); System.out.println("\t" + type + " " + ctx.Identifier() + args + ";"); }
public void enterMethodDeclaration(JavaParser.MethodDeclarationContext ctx) { enterMethodDeclaration(ctx, ctx.Identifier(), ctx.formalParameters(), ctx.type()); }