1 package org.python.parser.ast; 3 import org.python.parser.SimpleNode; 4 import java.io.DataOutputStream ; 5 import java.io.IOException ; 6 7 public class excepthandlerType extends SimpleNode { 8 public exprType type; 9 public exprType name; 10 public stmtType[] body; 11 12 public excepthandlerType(exprType type, exprType name, stmtType[] body) 13 { 14 this.type = type; 15 this.name = name; 16 this.body = body; 17 } 18 19 public excepthandlerType(exprType type, exprType name, stmtType[] body, 20 SimpleNode parent) { 21 this(type, name, body); 22 this.beginLine = parent.beginLine; 23 this.beginColumn = parent.beginColumn; 24 } 25 26 public String toString() { 27 StringBuffer sb = new StringBuffer ("excepthandler["); 28 sb.append("type="); 29 sb.append(dumpThis(this.type)); 30 sb.append(", "); 31 sb.append("name="); 32 sb.append(dumpThis(this.name)); 33 sb.append(", "); 34 sb.append("body="); 35 sb.append(dumpThis(this.body)); 36 sb.append("]"); 37 return sb.toString(); 38 } 39 40 public void pickle(DataOutputStream ostream) throws IOException { 41 pickleThis(49, ostream); 42 pickleThis(this.type, ostream); 43 pickleThis(this.name, ostream); 44 pickleThis(this.body, ostream); 45 } 46 47 public Object accept(VisitorIF visitor) throws Exception { 48 traverse(visitor); 49 return null; 50 } 51 52 public void traverse(VisitorIF visitor) throws Exception { 53 if (type != null) 54 type.accept(visitor); 55 if (name != null) 56 name.accept(visitor); 57 if (body != null) { 58 for (int i = 0; i < body.length; i++) { 59 if (body[i] != null) 60 body[i].accept(visitor); 61 } 62 } 63 } 64 65 } 66 | Popular Tags |