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