KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jruby > ast > visitor > AbstractVisitor


1 /***** BEGIN LICENSE BLOCK *****
2  * Version: CPL 1.0/GPL 2.0/LGPL 2.1
3  *
4  * The contents of this file are subject to the Common Public
5  * License Version 1.0 (the "License"); you may not use this file
6  * except in compliance with the License. You may obtain a copy of
7  * the License at http://www.eclipse.org/legal/cpl-v10.html
8  *
9  * Software distributed under the License is distributed on an "AS
10  * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
11  * implied. See the License for the specific language governing
12  * rights and limitations under the License.
13  *
14  * Copyright (C) 2002 Jan Arne Petersen <jpetersen@uni-bonn.de>
15  * Copyright (C) 2004 Anders Bengtsson <ndrsbngtssn@yahoo.se>
16  * Copyright (C) 2004 Thomas E Enebo <enebo@acm.org>
17  * Copyright (C) 2004 Stefan Matthias Aust <sma@3plus4.de>
18  *
19  * Alternatively, the contents of this file may be used under the terms of
20  * either of the GNU General Public License Version 2 or later (the "GPL"),
21  * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
22  * in which case the provisions of the GPL or the LGPL are applicable instead
23  * of those above. If you wish to allow use of your version of this file only
24  * under the terms of either the GPL or the LGPL, and not to allow others to
25  * use your version of this file under the terms of the CPL, indicate your
26  * decision by deleting the provisions above and replace them with the notice
27  * and other provisions required by the GPL or the LGPL. If you do not delete
28  * the provisions above, a recipient may use your version of this file under
29  * the terms of any one of the CPL, the GPL or the LGPL.
30  ***** END LICENSE BLOCK *****/

31 package org.jruby.ast.visitor;
32
33 import org.jruby.ast.AliasNode;
34 import org.jruby.ast.AndNode;
35 import org.jruby.ast.ArgsCatNode;
36 import org.jruby.ast.ArgsNode;
37 import org.jruby.ast.ArgsPushNode;
38 import org.jruby.ast.ArrayNode;
39 import org.jruby.ast.AttrAssignNode;
40 import org.jruby.ast.BackRefNode;
41 import org.jruby.ast.BeginNode;
42 import org.jruby.ast.BignumNode;
43 import org.jruby.ast.BlockArgNode;
44 import org.jruby.ast.BlockNode;
45 import org.jruby.ast.BlockPassNode;
46 import org.jruby.ast.BreakNode;
47 import org.jruby.ast.CallNode;
48 import org.jruby.ast.CaseNode;
49 import org.jruby.ast.ClassNode;
50 import org.jruby.ast.ClassVarAsgnNode;
51 import org.jruby.ast.ClassVarDeclNode;
52 import org.jruby.ast.ClassVarNode;
53 import org.jruby.ast.Colon2Node;
54 import org.jruby.ast.Colon3Node;
55 import org.jruby.ast.ConstDeclNode;
56 import org.jruby.ast.ConstNode;
57 import org.jruby.ast.DAsgnNode;
58 import org.jruby.ast.DRegexpNode;
59 import org.jruby.ast.DStrNode;
60 import org.jruby.ast.DSymbolNode;
61 import org.jruby.ast.DVarNode;
62 import org.jruby.ast.DXStrNode;
63 import org.jruby.ast.DefinedNode;
64 import org.jruby.ast.DefnNode;
65 import org.jruby.ast.DefsNode;
66 import org.jruby.ast.DotNode;
67 import org.jruby.ast.EnsureNode;
68 import org.jruby.ast.EvStrNode;
69 import org.jruby.ast.FCallNode;
70 import org.jruby.ast.FalseNode;
71 import org.jruby.ast.FixnumNode;
72 import org.jruby.ast.FlipNode;
73 import org.jruby.ast.FloatNode;
74 import org.jruby.ast.ForNode;
75 import org.jruby.ast.GlobalAsgnNode;
76 import org.jruby.ast.GlobalVarNode;
77 import org.jruby.ast.HashNode;
78 import org.jruby.ast.IfNode;
79 import org.jruby.ast.InstAsgnNode;
80 import org.jruby.ast.InstVarNode;
81 import org.jruby.ast.IterNode;
82 import org.jruby.ast.LocalAsgnNode;
83 import org.jruby.ast.LocalVarNode;
84 import org.jruby.ast.Match2Node;
85 import org.jruby.ast.Match3Node;
86 import org.jruby.ast.MatchNode;
87 import org.jruby.ast.ModuleNode;
88 import org.jruby.ast.MultipleAsgnNode;
89 import org.jruby.ast.NewlineNode;
90 import org.jruby.ast.NextNode;
91 import org.jruby.ast.NilNode;
92 import org.jruby.ast.Node;
93 import org.jruby.ast.NotNode;
94 import org.jruby.ast.NthRefNode;
95 import org.jruby.ast.OpAsgnAndNode;
96 import org.jruby.ast.OpAsgnNode;
97 import org.jruby.ast.OpAsgnOrNode;
98 import org.jruby.ast.OpElementAsgnNode;
99 import org.jruby.ast.OptNNode;
100 import org.jruby.ast.OrNode;
101 import org.jruby.ast.PostExeNode;
102 import org.jruby.ast.RedoNode;
103 import org.jruby.ast.RegexpNode;
104 import org.jruby.ast.RescueBodyNode;
105 import org.jruby.ast.RescueNode;
106 import org.jruby.ast.RetryNode;
107 import org.jruby.ast.ReturnNode;
108 import org.jruby.ast.RootNode;
109 import org.jruby.ast.SClassNode;
110 import org.jruby.ast.SValueNode;
111 import org.jruby.ast.SelfNode;
112 import org.jruby.ast.SplatNode;
113 import org.jruby.ast.StrNode;
114 import org.jruby.ast.SuperNode;
115 import org.jruby.ast.SymbolNode;
116 import org.jruby.ast.ToAryNode;
117 import org.jruby.ast.TrueNode;
118 import org.jruby.ast.UndefNode;
119 import org.jruby.ast.UntilNode;
120 import org.jruby.ast.VAliasNode;
121 import org.jruby.ast.VCallNode;
122 import org.jruby.ast.WhenNode;
123 import org.jruby.ast.WhileNode;
124 import org.jruby.ast.XStrNode;
125 import org.jruby.ast.YieldNode;
126 import org.jruby.ast.ZArrayNode;
127 import org.jruby.ast.ZSuperNode;
128 import org.jruby.evaluator.Instruction;
129
130 /** This visitor calls by default the return visitNode method for each visited Node.
131  *
132  * @author jpetersen
133  */

134 public abstract class AbstractVisitor implements NodeVisitor {
135
136     /**
137      * This method is called by default for each visited Node.
138      */

139     protected abstract Instruction visitNode(Node iVisited);
140
141     public Instruction visitNullNode() {
142         return visitNode(null);
143     }
144     
145     public Instruction acceptNode(Node node) {
146         if (node == null) {
147             return visitNullNode();
148         } else {
149             return node.accept(this);
150         }
151     }
152
153     public Instruction visitAliasNode(AliasNode iVisited) {
154         return visitNode(iVisited);
155     }
156
157     public Instruction visitAndNode(AndNode iVisited) {
158         return visitNode(iVisited);
159     }
160
161     public Instruction visitArgsCatNode(ArgsCatNode iVisited) {
162         return visitNode(iVisited);
163     }
164
165     public Instruction visitArgsNode(ArgsNode iVisited) {
166         return visitNode(iVisited);
167     }
168
169     public Instruction visitArrayNode(ArrayNode iVisited) {
170         return visitNode(iVisited);
171     }
172
173     public Instruction visitBackRefNode(BackRefNode iVisited) {
174         return visitNode(iVisited);
175     }
176
177     public Instruction visitBeginNode(BeginNode iVisited) {
178         return visitNode(iVisited);
179     }
180
181     public Instruction visitBlockArgNode(BlockArgNode iVisited) {
182         return visitNode(iVisited);
183     }
184
185     public Instruction visitBlockNode(BlockNode iVisited) {
186         return visitNode(iVisited);
187     }
188
189     public Instruction visitBlockPassNode(BlockPassNode iVisited) {
190         return visitNode(iVisited);
191     }
192
193     public Instruction visitBreakNode(BreakNode iVisited) {
194         return visitNode(iVisited);
195     }
196
197     public Instruction visitConstDeclNode(ConstDeclNode iVisited) {
198         return visitNode(iVisited);
199     }
200
201     public Instruction visitClassVarAsgnNode(ClassVarAsgnNode iVisited) {
202         return visitNode(iVisited);
203     }
204
205     public Instruction visitClassVarDeclNode(ClassVarDeclNode iVisited) {
206         return visitNode(iVisited);
207     }
208
209     public Instruction visitClassVarNode(ClassVarNode iVisited) {
210         return visitNode(iVisited);
211     }
212
213     public Instruction visitCallNode(CallNode iVisited) {
214         return visitNode(iVisited);
215     }
216
217     public Instruction visitCaseNode(CaseNode iVisited) {
218         return visitNode(iVisited);
219     }
220
221     public Instruction visitClassNode(ClassNode iVisited) {
222         return visitNode(iVisited);
223     }
224
225     public Instruction visitColon2Node(Colon2Node iVisited) {
226         return visitNode(iVisited);
227     }
228
229     public Instruction visitColon3Node(Colon3Node iVisited) {
230         return visitNode(iVisited);
231     }
232
233     public Instruction visitConstNode(ConstNode iVisited) {
234         return visitNode(iVisited);
235     }
236
237     public Instruction visitDAsgnNode(DAsgnNode iVisited) {
238         return visitNode(iVisited);
239     }
240
241     public Instruction visitDRegxNode(DRegexpNode iVisited) {
242         return visitNode(iVisited);
243     }
244
245     public Instruction visitDStrNode(DStrNode iVisited) {
246         return visitNode(iVisited);
247     }
248
249     public Instruction visitDSymbolNode(DSymbolNode iVisited) {
250         return visitNode(iVisited);
251     }
252
253     public Instruction visitDVarNode(DVarNode iVisited) {
254         return visitNode(iVisited);
255     }
256
257     public Instruction visitDXStrNode(DXStrNode iVisited) {
258         return visitNode(iVisited);
259     }
260
261     public Instruction visitDefinedNode(DefinedNode iVisited) {
262         return visitNode(iVisited);
263     }
264
265     public Instruction visitDefnNode(DefnNode iVisited) {
266         return visitNode(iVisited);
267     }
268
269     public Instruction visitDefsNode(DefsNode iVisited) {
270         return visitNode(iVisited);
271     }
272
273     public Instruction visitDotNode(DotNode iVisited) {
274         return visitNode(iVisited);
275     }
276
277     public Instruction visitEnsureNode(EnsureNode iVisited) {
278         return visitNode(iVisited);
279     }
280
281     public Instruction visitEvStrNode(EvStrNode iVisited) {
282         return visitNode(iVisited);
283     }
284
285     public Instruction visitFCallNode(FCallNode iVisited) {
286         return visitNode(iVisited);
287     }
288
289     public Instruction visitFalseNode(FalseNode iVisited) {
290         return visitNode(iVisited);
291     }
292
293     public Instruction visitFlipNode(FlipNode iVisited) {
294         return visitNode(iVisited);
295     }
296
297     public Instruction visitForNode(ForNode iVisited) {
298         return visitNode(iVisited);
299     }
300
301     public Instruction visitGlobalAsgnNode(GlobalAsgnNode iVisited) {
302         return visitNode(iVisited);
303     }
304
305     public Instruction visitGlobalVarNode(GlobalVarNode iVisited) {
306         return visitNode(iVisited);
307     }
308
309     public Instruction visitHashNode(HashNode iVisited) {
310         return visitNode(iVisited);
311     }
312
313     public Instruction visitInstAsgnNode(InstAsgnNode iVisited) {
314         return visitNode(iVisited);
315     }
316
317     public Instruction visitInstVarNode(InstVarNode iVisited) {
318         return visitNode(iVisited);
319     }
320
321     public Instruction visitIfNode(IfNode iVisited) {
322         return visitNode(iVisited);
323     }
324
325     public Instruction visitIterNode(IterNode iVisited) {
326         return visitNode(iVisited);
327     }
328
329     public Instruction visitLocalAsgnNode(LocalAsgnNode iVisited) {
330         return visitNode(iVisited);
331     }
332
333     public Instruction visitLocalVarNode(LocalVarNode iVisited) {
334         return visitNode(iVisited);
335     }
336
337     public Instruction visitMultipleAsgnNode(MultipleAsgnNode iVisited) {
338         return visitNode(iVisited);
339     }
340
341     public Instruction visitMatch2Node(Match2Node iVisited) {
342         return visitNode(iVisited);
343     }
344
345     public Instruction visitMatch3Node(Match3Node iVisited) {
346         return visitNode(iVisited);
347     }
348
349     public Instruction visitMatchNode(MatchNode iVisited) {
350         return visitNode(iVisited);
351     }
352
353     public Instruction visitModuleNode(ModuleNode iVisited) {
354         return visitNode(iVisited);
355     }
356
357     public Instruction visitNewlineNode(NewlineNode iVisited) {
358         return visitNode(iVisited);
359     }
360
361     public Instruction visitNextNode(NextNode iVisited) {
362         return visitNode(iVisited);
363     }
364
365     public Instruction visitNilNode(NilNode iVisited) {
366         return visitNode(iVisited);
367     }
368
369     public Instruction visitNotNode(NotNode iVisited) {
370         return visitNode(iVisited);
371     }
372
373     public Instruction visitNthRefNode(NthRefNode iVisited) {
374         return visitNode(iVisited);
375     }
376
377     public Instruction visitOpElementAsgnNode(OpElementAsgnNode iVisited) {
378         return visitNode(iVisited);
379     }
380
381     public Instruction visitOpAsgnNode(OpAsgnNode iVisited) {
382         return visitNode(iVisited);
383     }
384
385     public Instruction visitOpAsgnAndNode(OpAsgnAndNode iVisited) {
386         return visitNode(iVisited);
387     }
388
389     public Instruction visitOpAsgnOrNode(OpAsgnOrNode iVisited) {
390         return visitNode(iVisited);
391     }
392
393     public Instruction visitOptNNode(OptNNode iVisited) {
394         return visitNode(iVisited);
395     }
396
397     public Instruction visitOrNode(OrNode iVisited) {
398         return visitNode(iVisited);
399     }
400
401     public Instruction visitPostExeNode(PostExeNode iVisited) {
402         return visitNode(iVisited);
403     }
404
405     public Instruction visitRedoNode(RedoNode iVisited) {
406         return visitNode(iVisited);
407     }
408
409     public Instruction visitRescueBodyNode(RescueBodyNode iVisited) {
410         return visitNode(iVisited);
411     }
412
413     public Instruction visitRescueNode(RescueNode iVisited) {
414         return visitNode(iVisited);
415     }
416
417     public Instruction visitRetryNode(RetryNode iVisited) {
418         return visitNode(iVisited);
419     }
420
421     public Instruction visitReturnNode(ReturnNode iVisited) {
422         return visitNode(iVisited);
423     }
424     
425     public Instruction visitRootNode(RootNode iVisited) {
426         return visitNode(iVisited);
427     }
428
429     public Instruction visitSClassNode(SClassNode iVisited) {
430         return visitNode(iVisited);
431     }
432
433     public Instruction visitSelfNode(SelfNode iVisited) {
434         return visitNode(iVisited);
435     }
436     
437     public Instruction visitSplatNode(SplatNode iVisited) {
438         return visitNode(iVisited);
439     }
440
441     public Instruction visitStrNode(StrNode iVisited) {
442         return visitNode(iVisited);
443     }
444
445     public Instruction visitSValueNode(SValueNode iVisited) {
446         return visitNode(iVisited);
447     }
448
449     public Instruction visitSuperNode(SuperNode iVisited) {
450         return visitNode(iVisited);
451     }
452
453     public Instruction visitToAryNode(ToAryNode iVisited) {
454         return visitNode(iVisited);
455     }
456
457     public Instruction visitTrueNode(TrueNode iVisited) {
458         return visitNode(iVisited);
459     }
460
461     public Instruction visitUndefNode(UndefNode iVisited) {
462         return visitNode(iVisited);
463     }
464
465     public Instruction visitUntilNode(UntilNode iVisited) {
466         return visitNode(iVisited);
467     }
468
469     public Instruction visitVAliasNode(VAliasNode iVisited) {
470         return visitNode(iVisited);
471     }
472
473     public Instruction visitVCallNode(VCallNode iVisited) {
474         return visitNode(iVisited);
475     }
476
477     public Instruction visitWhenNode(WhenNode iVisited) {
478         return visitNode(iVisited);
479     }
480
481     public Instruction visitWhileNode(WhileNode iVisited) {
482         return visitNode(iVisited);
483     }
484
485     public Instruction visitXStrNode(XStrNode iVisited) {
486         return visitNode(iVisited);
487     }
488
489     public Instruction visitYieldNode(YieldNode iVisited) {
490         return visitNode(iVisited);
491     }
492
493     public Instruction visitZArrayNode(ZArrayNode iVisited) {
494         return visitNode(iVisited);
495     }
496
497     public Instruction visitZSuperNode(ZSuperNode iVisited) {
498         return visitNode(iVisited);
499     }
500     
501     public Instruction visitBignumNode(BignumNode iVisited) {
502         return visitNode(iVisited);
503     }
504
505     public Instruction visitFixnumNode(FixnumNode iVisited) {
506         return visitNode(iVisited);
507     }
508
509     public Instruction visitFloatNode(FloatNode iVisited) {
510         return visitNode(iVisited);
511     }
512
513     public Instruction visitRegexpNode(RegexpNode iVisited) {
514         return visitNode(iVisited);
515     }
516
517     public Instruction visitSymbolNode(SymbolNode iVisited) {
518         return visitNode(iVisited);
519     }
520     
521     public Instruction visitArgsPushNode(ArgsPushNode iVisited) {
522         return visitNode(iVisited);
523     }
524
525     public Instruction visitAttrAssignNode(AttrAssignNode iVisited) {
526         return visitNode(iVisited);
527     }
528 }
529
Popular Tags