KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > beaver > spec > ast > TreeWalker


1 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
2  * This file is part of Beaver Parser Generator. *
3  * Copyright (C) 2003,2004 Alexander Demenchuk <alder@softanvil.com>. *
4  * All rights reserved. *
5  * See the file "LICENSE" for the terms and conditions for copying, *
6  * distribution and modification of Beaver. *
7  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */

8
9 package beaver.spec.ast;
10
11 /**
12  *
13  */

14 public class TreeWalker
15 {
16     public void visit(GrammarTreeRoot node)
17     {
18         for (int i = 0; i < node.declarations.length; i++)
19         {
20             node.declarations[i].accept(this);
21         }
22         for (int i = 0; i < node.rules.length; i++)
23         {
24             node.rules[i].accept(this);
25         }
26     }
27     
28     public void visit(Declaration.Error node)
29     {
30         // leaf
31
}
32
33     public void visit(Declaration.Header node)
34     {
35         // leaf
36
}
37     
38     public void visit(Declaration.PackageName node)
39     {
40         // leaf
41
}
42
43     public void visit(Declaration.Imports node)
44     {
45         // leaf
46
}
47     
48     public void visit(Declaration.ClassName node)
49     {
50         // leaf
51
}
52     
53     public void visit(Declaration.ClassCode node)
54     {
55         // leaf
56
}
57     
58     public void visit(Declaration.ConstructorCode node)
59     {
60         // leaf
61
}
62     
63     public void visit(Declaration.LeftAssoc node)
64     {
65         // leaf
66
}
67     
68     public void visit(Declaration.RightAssoc node)
69     {
70         // leaf
71
}
72     
73     public void visit(Declaration.NonAssoc node)
74     {
75         // leaf
76
}
77     
78     public void visit(Declaration.Goal node)
79     {
80         // leaf
81
}
82     
83     public void visit(Declaration.ListType node)
84     {
85         // leaf
86
}
87     
88     public void visit(Declaration.Terminals node)
89     {
90         // leaf
91
}
92     
93     public void visit(Declaration.TypeOf node)
94     {
95         // leaf
96
}
97     
98     public void visit(Rule node)
99     {
100         for (int i = 0; i < node.defs.length; i++)
101         {
102             node.defs[i].accept(this);
103         }
104     }
105     
106     public void visit(Rule.Definition node)
107     {
108         for (int i = 0; i < node.elements.length; i++)
109         {
110             node.elements[i].accept(this);
111         }
112     }
113     
114     public void visit(Rule.Definition.Element node)
115     {
116         // leaf
117
}
118 }
119
Popular Tags