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