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