KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > python > parser > ast > TryExcept


1 // Autogenerated AST node
2
package org.python.parser.ast;
3 import org.python.parser.SimpleNode;
4 import java.io.DataOutputStream JavaDoc;
5 import java.io.IOException JavaDoc;
6
7 public class TryExcept extends stmtType {
8     public stmtType[] body;
9     public excepthandlerType[] handlers;
10     public stmtType[] orelse;
11
12     public TryExcept(stmtType[] body, excepthandlerType[] handlers,
13     stmtType[] orelse) {
14         this.body = body;
15         this.handlers = handlers;
16         this.orelse = orelse;
17     }
18
19     public TryExcept(stmtType[] body, excepthandlerType[] handlers,
20     stmtType[] orelse, SimpleNode parent) {
21         this(body, handlers, orelse);
22         this.beginLine = parent.beginLine;
23         this.beginColumn = parent.beginColumn;
24     }
25
26     public String JavaDoc toString() {
27         StringBuffer JavaDoc sb = new StringBuffer JavaDoc("TryExcept[");
28         sb.append("body=");
29         sb.append(dumpThis(this.body));
30         sb.append(", ");
31         sb.append("handlers=");
32         sb.append(dumpThis(this.handlers));
33         sb.append(", ");
34         sb.append("orelse=");
35         sb.append(dumpThis(this.orelse));
36         sb.append("]");
37         return sb.toString();
38     }
39
40     public void pickle(DataOutputStream JavaDoc ostream) throws IOException JavaDoc {
41         pickleThis(17, ostream);
42         pickleThis(this.body, ostream);
43         pickleThis(this.handlers, ostream);
44         pickleThis(this.orelse, ostream);
45     }
46
47     public Object JavaDoc accept(VisitorIF visitor) throws Exception JavaDoc {
48         return visitor.visitTryExcept(this);
49     }
50
51     public void traverse(VisitorIF visitor) throws Exception JavaDoc {
52         if (body != null) {
53             for (int i = 0; i < body.length; i++) {
54                 if (body[i] != null)
55                     body[i].accept(visitor);
56             }
57         }
58         if (handlers != null) {
59             for (int i = 0; i < handlers.length; i++) {
60                 if (handlers[i] != null)
61                     handlers[i].accept(visitor);
62             }
63         }
64         if (orelse != null) {
65             for (int i = 0; i < orelse.length; i++) {
66                 if (orelse[i] != null)
67                     orelse[i].accept(visitor);
68             }
69         }
70     }
71
72 }
73
Popular Tags