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