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 Assert extends stmtType { 8 public exprType test; 9 public exprType msg; 10 11 public Assert(exprType test, exprType msg) { 12 this.test = test; 13 this.msg = msg; 14 } 15 16 public Assert(exprType test, exprType msg, SimpleNode parent) { 17 this(test, msg); 18 this.beginLine = parent.beginLine; 19 this.beginColumn = parent.beginColumn; 20 } 21 22 public String toString() { 23 StringBuffer sb = new StringBuffer ("Assert["); 24 sb.append("test="); 25 sb.append(dumpThis(this.test)); 26 sb.append(", "); 27 sb.append("msg="); 28 sb.append(dumpThis(this.msg)); 29 sb.append("]"); 30 return sb.toString(); 31 } 32 33 public void pickle(DataOutputStream ostream) throws IOException { 34 pickleThis(19, ostream); 35 pickleThis(this.test, ostream); 36 pickleThis(this.msg, ostream); 37 } 38 39 public Object accept(VisitorIF visitor) throws Exception { 40 return visitor.visitAssert(this); 41 } 42 43 public void traverse(VisitorIF visitor) throws Exception { 44 if (test != null) 45 test.accept(visitor); 46 if (msg != null) 47 msg.accept(visitor); 48 } 49 50 } 51 | Popular Tags |