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