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 Print extends stmtType { 8 public exprType dest; 9 public exprType[] values; 10 public boolean nl; 11 12 public Print(exprType dest, exprType[] values, boolean nl) { 13 this.dest = dest; 14 this.values = values; 15 this.nl = nl; 16 } 17 18 public Print(exprType dest, exprType[] values, boolean nl, SimpleNode 19 parent) { 20 this(dest, values, nl); 21 this.beginLine = parent.beginLine; 22 this.beginColumn = parent.beginColumn; 23 } 24 25 public String toString() { 26 StringBuffer sb = new StringBuffer ("Print["); 27 sb.append("dest="); 28 sb.append(dumpThis(this.dest)); 29 sb.append(", "); 30 sb.append("values="); 31 sb.append(dumpThis(this.values)); 32 sb.append(", "); 33 sb.append("nl="); 34 sb.append(dumpThis(this.nl)); 35 sb.append("]"); 36 return sb.toString(); 37 } 38 39 public void pickle(DataOutputStream ostream) throws IOException { 40 pickleThis(12, ostream); 41 pickleThis(this.dest, ostream); 42 pickleThis(this.values, ostream); 43 pickleThis(this.nl, ostream); 44 } 45 46 public Object accept(VisitorIF visitor) throws Exception { 47 return visitor.visitPrint(this); 48 } 49 50 public void traverse(VisitorIF visitor) throws Exception { 51 if (dest != null) 52 dest.accept(visitor); 53 if (values != null) { 54 for (int i = 0; i < values.length; i++) { 55 if (values[i] != null) 56 values[i].accept(visitor); 57 } 58 } 59 } 60 61 } 62 | Popular Tags |