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