001: /**
002: *
003: * Copyright 2005 Jeremy Rayner
004: *
005: * Licensed under the Apache License, Version 2.0 (the "License");
006: * you may not use this file except in compliance with the License.
007: * You may obtain a copy of the License at
008: *
009: * http://www.apache.org/licenses/LICENSE-2.0
010: *
011: * Unless required by applicable law or agreed to in writing, software
012: * distributed under the License is distributed on an "AS IS" BASIS,
013: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014: * See the License for the specific language governing permissions and
015: * limitations under the License.
016: *
017: **/package org.codehaus.groovy.antlr.treewalker;
018:
019: import org.codehaus.groovy.antlr.GroovySourceAST;
020:
021: /**
022: * An interface for visiting a GroovySourceAST node.
023: *
024: * @author <a href="mailto:groovy@ross-rayner.com">Jeremy Rayner</a>
025: * @version $Revision: 3915 $
026: */
027:
028: public interface Visitor {
029: final int OPENING_VISIT = 1;
030: final int SECOND_VISIT = 2; // only used on rare occasions, e.g. the '(' in this snippet... @Foo ( a=1, b=2, c=3)
031: final int SUBSEQUENT_VISIT = 3;
032: final int CLOSING_VISIT = 4;
033:
034: void setUp();
035:
036: void visitAbstract(GroovySourceAST t, int visit);
037:
038: void visitAnnotation(GroovySourceAST t, int visit);
039:
040: void visitAnnotations(GroovySourceAST t, int visit);
041:
042: void visitAnnotationArrayInit(GroovySourceAST t, int visit);
043:
044: void visitAnnotationDef(GroovySourceAST t, int visit);
045:
046: void visitAnnotationFieldDef(GroovySourceAST t, int visit);
047:
048: void visitAnnotationMemberValuePair(GroovySourceAST t, int visit);
049:
050: void visitArrayDeclarator(GroovySourceAST t, int visit);
051:
052: void visitAssign(GroovySourceAST t, int visit);
053:
054: void visitAt(GroovySourceAST t, int visit);
055:
056: void visitBand(GroovySourceAST t, int visit);
057:
058: void visitBandAssign(GroovySourceAST t, int visit);
059:
060: void visitBigSuffix(GroovySourceAST t, int visit);
061:
062: void visitBlock(GroovySourceAST t, int visit);
063:
064: void visitBnot(GroovySourceAST t, int visit);
065:
066: void visitBor(GroovySourceAST t, int visit);
067:
068: void visitBorAssign(GroovySourceAST t, int visit);
069:
070: void visitBsr(GroovySourceAST t, int visit);
071:
072: void visitBsrAssign(GroovySourceAST t, int visit);
073:
074: void visitBxor(GroovySourceAST t, int visit);
075:
076: void visitBxorAssign(GroovySourceAST t, int visit);
077:
078: void visitCaseGroup(GroovySourceAST t, int visit);
079:
080: void visitClassDef(GroovySourceAST t, int visit);
081:
082: void visitClosedBlock(GroovySourceAST t, int visit);
083:
084: void visitClosureOp(GroovySourceAST t, int visit);
085:
086: void visitColon(GroovySourceAST t, int visit);
087:
088: void visitComma(GroovySourceAST t, int visit);
089:
090: void visitCompareTo(GroovySourceAST t, int visit);
091:
092: void visitCtorCall(GroovySourceAST t, int visit);
093:
094: void visitCtorIdent(GroovySourceAST t, int visit);
095:
096: void visitDec(GroovySourceAST t, int visit);
097:
098: void visitDigit(GroovySourceAST t, int visit);
099:
100: void visitDiv(GroovySourceAST t, int visit);
101:
102: void visitDivAssign(GroovySourceAST t, int visit);
103:
104: void visitDollar(GroovySourceAST t, int visit);
105:
106: void visitDot(GroovySourceAST t, int visit);
107:
108: void visitDynamicMember(GroovySourceAST t, int visit);
109:
110: void visitElist(GroovySourceAST t, int visit);
111:
112: void visitEmptyStat(GroovySourceAST t, int visit);
113:
114: void visitEnumConstantDef(GroovySourceAST t, int visit);
115:
116: void visitEnumDef(GroovySourceAST t, int visit);
117:
118: void visitEof(GroovySourceAST t, int visit);
119:
120: void visitEqual(GroovySourceAST t, int visit);
121:
122: void visitEsc(GroovySourceAST t, int visit);
123:
124: void visitExponent(GroovySourceAST t, int visit);
125:
126: void visitExpr(GroovySourceAST t, int visit);
127:
128: void visitExtendsClause(GroovySourceAST t, int visit);
129:
130: void visitFinal(GroovySourceAST t, int visit);
131:
132: void visitFloatSuffix(GroovySourceAST t, int visit);
133:
134: void visitForCondition(GroovySourceAST t, int visit);
135:
136: void visitForEachClause(GroovySourceAST t, int visit);
137:
138: void visitForInit(GroovySourceAST t, int visit);
139:
140: void visitForInIterable(GroovySourceAST t, int visit);
141:
142: void visitForIterator(GroovySourceAST t, int visit);
143:
144: void visitGe(GroovySourceAST t, int visit);
145:
146: void visitGt(GroovySourceAST t, int visit);
147:
148: void visitHexDigit(GroovySourceAST t, int visit);
149:
150: void visitIdent(GroovySourceAST t, int visit);
151:
152: void visitImplementsClause(GroovySourceAST t, int visit);
153:
154: void visitImplicitParameters(GroovySourceAST t, int visit);
155:
156: void visitImport(GroovySourceAST t, int visit);
157:
158: void visitInc(GroovySourceAST t, int visit);
159:
160: void visitIndexOp(GroovySourceAST t, int visit);
161:
162: void visitInstanceInit(GroovySourceAST t, int visit);
163:
164: void visitInterfaceDef(GroovySourceAST t, int visit);
165:
166: void visitLabeledArg(GroovySourceAST t, int visit);
167:
168: void visitLabeledStat(GroovySourceAST t, int visit);
169:
170: void visitLand(GroovySourceAST t, int visit);
171:
172: void visitLbrack(GroovySourceAST t, int visit);
173:
174: void visitLcurly(GroovySourceAST t, int visit);
175:
176: void visitLe(GroovySourceAST t, int visit);
177:
178: void visitLetter(GroovySourceAST t, int visit);
179:
180: void visitListConstructor(GroovySourceAST t, int visit);
181:
182: void visitLiteralAny(GroovySourceAST t, int visit);
183:
184: void visitLiteralAs(GroovySourceAST t, int visit);
185:
186: void visitLiteralAssert(GroovySourceAST t, int visit);
187:
188: void visitLiteralBoolean(GroovySourceAST t, int visit);
189:
190: void visitLiteralBreak(GroovySourceAST t, int visit);
191:
192: void visitLiteralByte(GroovySourceAST t, int visit);
193:
194: void visitLiteralCase(GroovySourceAST t, int visit);
195:
196: void visitLiteralCatch(GroovySourceAST t, int visit);
197:
198: void visitLiteralChar(GroovySourceAST t, int visit);
199:
200: void visitLiteralClass(GroovySourceAST t, int visit);
201:
202: void visitLiteralContinue(GroovySourceAST t, int visit);
203:
204: void visitLiteralDef(GroovySourceAST t, int visit);
205:
206: void visitLiteralDefault(GroovySourceAST t, int visit);
207:
208: void visitLiteralDouble(GroovySourceAST t, int visit);
209:
210: void visitLiteralElse(GroovySourceAST t, int visit);
211:
212: void visitLiteralEnum(GroovySourceAST t, int visit);
213:
214: void visitLiteralExtends(GroovySourceAST t, int visit);
215:
216: void visitLiteralFalse(GroovySourceAST t, int visit);
217:
218: void visitLiteralFinally(GroovySourceAST t, int visit);
219:
220: void visitLiteralFloat(GroovySourceAST t, int visit);
221:
222: void visitLiteralFor(GroovySourceAST t, int visit);
223:
224: void visitLiteralIf(GroovySourceAST t, int visit);
225:
226: void visitLiteralImplements(GroovySourceAST t, int visit);
227:
228: void visitLiteralImport(GroovySourceAST t, int visit);
229:
230: void visitLiteralIn(GroovySourceAST t, int visit);
231:
232: void visitLiteralInstanceof(GroovySourceAST t, int visit);
233:
234: void visitLiteralInt(GroovySourceAST t, int visit);
235:
236: void visitLiteralInterface(GroovySourceAST t, int visit);
237:
238: void visitLiteralLong(GroovySourceAST t, int visit);
239:
240: void visitLiteralNative(GroovySourceAST t, int visit);
241:
242: void visitLiteralNew(GroovySourceAST t, int visit);
243:
244: void visitLiteralNull(GroovySourceAST t, int visit);
245:
246: void visitLiteralPackage(GroovySourceAST t, int visit);
247:
248: void visitLiteralPrivate(GroovySourceAST t, int visit);
249:
250: void visitLiteralProtected(GroovySourceAST t, int visit);
251:
252: void visitLiteralPublic(GroovySourceAST t, int visit);
253:
254: void visitLiteralReturn(GroovySourceAST t, int visit);
255:
256: void visitLiteralShort(GroovySourceAST t, int visit);
257:
258: void visitLiteralStatic(GroovySourceAST t, int visit);
259:
260: void visitLiteralSuper(GroovySourceAST t, int visit);
261:
262: void visitLiteralSwitch(GroovySourceAST t, int visit);
263:
264: void visitLiteralSynchronized(GroovySourceAST t, int visit);
265:
266: void visitLiteralThis(GroovySourceAST t, int visit);
267:
268: void visitLiteralThreadsafe(GroovySourceAST t, int visit);
269:
270: void visitLiteralThrow(GroovySourceAST t, int visit);
271:
272: void visitLiteralThrows(GroovySourceAST t, int visit);
273:
274: void visitLiteralTransient(GroovySourceAST t, int visit);
275:
276: void visitLiteralTrue(GroovySourceAST t, int visit);
277:
278: void visitLiteralTry(GroovySourceAST t, int visit);
279:
280: void visitLiteralVoid(GroovySourceAST t, int visit);
281:
282: void visitLiteralVolatile(GroovySourceAST t, int visit);
283:
284: void visitLiteralWhile(GroovySourceAST t, int visit);
285:
286: void visitLiteralWith(GroovySourceAST t, int visit);
287:
288: void visitLnot(GroovySourceAST t, int visit);
289:
290: void visitLor(GroovySourceAST t, int visit);
291:
292: void visitLparen(GroovySourceAST t, int visit);
293:
294: void visitLt(GroovySourceAST t, int visit);
295:
296: void visitMapConstructor(GroovySourceAST t, int visit);
297:
298: void visitMemberPointer(GroovySourceAST t, int visit);
299:
300: void visitMethodCall(GroovySourceAST t, int visit);
301:
302: void visitMethodDef(GroovySourceAST t, int visit);
303:
304: void visitMinus(GroovySourceAST t, int visit);
305:
306: void visitMinusAssign(GroovySourceAST t, int visit);
307:
308: void visitMlComment(GroovySourceAST t, int visit);
309:
310: void visitMod(GroovySourceAST t, int visit);
311:
312: void visitModifiers(GroovySourceAST t, int visit);
313:
314: void visitModAssign(GroovySourceAST t, int visit);
315:
316: void visitNls(GroovySourceAST t, int visit);
317:
318: void visitNotEqual(GroovySourceAST t, int visit);
319:
320: void visitNullTreeLookahead(GroovySourceAST t, int visit);
321:
322: void visitNumBigDecimal(GroovySourceAST t, int visit);
323:
324: void visitNumBigInt(GroovySourceAST t, int visit);
325:
326: void visitNumDouble(GroovySourceAST t, int visit);
327:
328: void visitNumFloat(GroovySourceAST t, int visit);
329:
330: void visitNumInt(GroovySourceAST t, int visit);
331:
332: void visitNumLong(GroovySourceAST t, int visit);
333:
334: void visitObjblock(GroovySourceAST t, int visit);
335:
336: void visitOneNl(GroovySourceAST t, int visit);
337:
338: void visitOptionalDot(GroovySourceAST t, int visit);
339:
340: void visitPackageDef(GroovySourceAST t, int visit);
341:
342: void visitParameters(GroovySourceAST t, int visit);
343:
344: void visitParameterDef(GroovySourceAST t, int visit);
345:
346: void visitPlus(GroovySourceAST t, int visit);
347:
348: void visitPlusAssign(GroovySourceAST t, int visit);
349:
350: void visitPostDec(GroovySourceAST t, int visit);
351:
352: void visitPostInc(GroovySourceAST t, int visit);
353:
354: void visitQuestion(GroovySourceAST t, int visit);
355:
356: void visitRangeExclusive(GroovySourceAST t, int visit);
357:
358: void visitRangeInclusive(GroovySourceAST t, int visit);
359:
360: void visitRbrack(GroovySourceAST t, int visit);
361:
362: void visitRcurly(GroovySourceAST t, int visit);
363:
364: void visitRegexpCtorEnd(GroovySourceAST t, int visit);
365:
366: void visitRegexpLiteral(GroovySourceAST t, int visit);
367:
368: void visitRegexpSymbol(GroovySourceAST t, int visit);
369:
370: void visitRegexFind(GroovySourceAST t, int visit);
371:
372: void visitRegexMatch(GroovySourceAST t, int visit);
373:
374: void visitRparen(GroovySourceAST t, int visit);
375:
376: void visitScopeEscape(GroovySourceAST t, int visit);
377:
378: void visitSelectSlot(GroovySourceAST t, int visit);
379:
380: void visitSemi(GroovySourceAST t, int visit);
381:
382: void visitShComment(GroovySourceAST t, int visit);
383:
384: void visitSl(GroovySourceAST t, int visit);
385:
386: void visitSlist(GroovySourceAST t, int visit);
387:
388: void visitSlAssign(GroovySourceAST t, int visit);
389:
390: void visitSlComment(GroovySourceAST t, int visit);
391:
392: void visitSpreadArg(GroovySourceAST t, int visit);
393:
394: void visitSpreadDot(GroovySourceAST t, int visit);
395:
396: void visitSpreadMapArg(GroovySourceAST t, int visit);
397:
398: void visitSr(GroovySourceAST t, int visit);
399:
400: void visitSrAssign(GroovySourceAST t, int visit);
401:
402: void visitStar(GroovySourceAST t, int visit);
403:
404: void visitStarAssign(GroovySourceAST t, int visit);
405:
406: void visitStarStar(GroovySourceAST t, int visit);
407:
408: void visitStarStarAssign(GroovySourceAST t, int visit);
409:
410: void visitStaticImport(GroovySourceAST t, int visit);
411:
412: void visitStaticInit(GroovySourceAST t, int visit);
413:
414: void visitStrictfp(GroovySourceAST t, int visit);
415:
416: void visitStringCh(GroovySourceAST t, int visit);
417:
418: void visitStringConstructor(GroovySourceAST t, int visit);
419:
420: void visitStringCtorEnd(GroovySourceAST t, int visit);
421:
422: void visitStringCtorMiddle(GroovySourceAST t, int visit);
423:
424: void visitStringCtorStart(GroovySourceAST t, int visit);
425:
426: void visitStringLiteral(GroovySourceAST t, int visit);
427:
428: void visitStringNl(GroovySourceAST t, int visit);
429:
430: void visitSuperCtorCall(GroovySourceAST t, int visit);
431:
432: void visitTripleDot(GroovySourceAST t, int visit);
433:
434: void visitType(GroovySourceAST t, int visit);
435:
436: void visitTypecast(GroovySourceAST t, int visit);
437:
438: void visitTypeArgument(GroovySourceAST t, int visit);
439:
440: void visitTypeArguments(GroovySourceAST t, int visit);
441:
442: void visitTypeLowerBounds(GroovySourceAST t, int visit);
443:
444: void visitTypeParameter(GroovySourceAST t, int visit);
445:
446: void visitTypeParameters(GroovySourceAST t, int visit);
447:
448: void visitTypeUpperBounds(GroovySourceAST t, int visit);
449:
450: void visitUnaryMinus(GroovySourceAST t, int visit);
451:
452: void visitUnaryPlus(GroovySourceAST t, int visit);
453:
454: void visitUnusedConst(GroovySourceAST t, int visit);
455:
456: void visitUnusedDo(GroovySourceAST t, int visit);
457:
458: void visitUnusedGoto(GroovySourceAST t, int visit);
459:
460: void visitVariableDef(GroovySourceAST t, int visit);
461:
462: void visitVariableParameterDef(GroovySourceAST t, int visit);
463:
464: void visitVocab(GroovySourceAST t, int visit);
465:
466: void visitWildcardType(GroovySourceAST t, int visit);
467:
468: void visitWs(GroovySourceAST t, int visit);
469:
470: void visitDefault(GroovySourceAST t, int visit);
471:
472: void tearDown();
473:
474: void push(GroovySourceAST t);
475:
476: GroovySourceAST pop();
477: }
|