KickJava   Java API By Example, From Geeks To Geeks.

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


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