01: // Autogenerated AST node
02: package org.python.parser.ast;
03:
04: import org.python.parser.SimpleNode;
05: import java.io.DataOutputStream;
06: import java.io.IOException;
07:
08: public class For extends stmtType {
09: public exprType target;
10: public exprType iter;
11: public stmtType[] body;
12: public stmtType[] orelse;
13:
14: public For(exprType target, exprType iter, stmtType[] body,
15: stmtType[] orelse) {
16: this .target = target;
17: this .iter = iter;
18: this .body = body;
19: this .orelse = orelse;
20: }
21:
22: public For(exprType target, exprType iter, stmtType[] body,
23: stmtType[] orelse, SimpleNode parent) {
24: this (target, iter, body, orelse);
25: this .beginLine = parent.beginLine;
26: this .beginColumn = parent.beginColumn;
27: }
28:
29: public String toString() {
30: StringBuffer sb = new StringBuffer("For[");
31: sb.append("target=");
32: sb.append(dumpThis(this .target));
33: sb.append(", ");
34: sb.append("iter=");
35: sb.append(dumpThis(this .iter));
36: sb.append(", ");
37: sb.append("body=");
38: sb.append(dumpThis(this .body));
39: sb.append(", ");
40: sb.append("orelse=");
41: sb.append(dumpThis(this .orelse));
42: sb.append("]");
43: return sb.toString();
44: }
45:
46: public void pickle(DataOutputStream ostream) throws IOException {
47: pickleThis(13, ostream);
48: pickleThis(this .target, ostream);
49: pickleThis(this .iter, ostream);
50: pickleThis(this .body, ostream);
51: pickleThis(this .orelse, ostream);
52: }
53:
54: public Object accept(VisitorIF visitor) throws Exception {
55: return visitor.visitFor(this );
56: }
57:
58: public void traverse(VisitorIF visitor) throws Exception {
59: if (target != null)
60: target.accept(visitor);
61: if (iter != null)
62: iter.accept(visitor);
63: if (body != null) {
64: for (int i = 0; i < body.length; i++) {
65: if (body[i] != null)
66: body[i].accept(visitor);
67: }
68: }
69: if (orelse != null) {
70: for (int i = 0; i < orelse.length; i++) {
71: if (orelse[i] != null)
72: orelse[i].accept(visitor);
73: }
74: }
75: }
76:
77: }
|