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