1 2 23 24 25 package VTransformer; 26 27 import java.io.PrintStream ; 28 29 public class AddAcceptVisitor extends UnparseVisitor 30 { 31 32 public AddAcceptVisitor(PrintStream o) 33 { 34 super(o); 35 } 36 37 38 public Object visit(ASTClassBodyDeclaration node, Object data) 39 { 40 41 if (node == node.jjtGetParent().jjtGetChild(0)) { 42 43 45 StringBuffer pre = new StringBuffer (""); 46 for (int i = 1; i < node.getFirstToken().beginColumn; ++i) { 47 pre.append(" "); 48 } 49 50 out.println(pre + ""); 51 out.println(pre + "/** Accept the visitor. **/"); 52 out.println(pre + "public Object jjtAccept(JavaParserVisitor visitor, Object data) {"); 53 out.println(pre + " return visitor.visit(this, data);"); 54 out.println(pre + "}"); 55 } 56 return super.visit(node, data); 57 } 58 59 } 60 | Popular Tags |