コード例 #1
0
 /** 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 + ";");
 }
コード例 #2
0
 public void enterMethodDeclaration(JavaParser.MethodDeclarationContext ctx) {
   enterMethodDeclaration(ctx, ctx.Identifier(), ctx.formalParameters(), ctx.type());
 }