001: /*
002:
003: $Id: GroovyCodeVisitor.java 3891 2006-07-07 10:49:57Z blackdrag $
004:
005:
006:
007: Copyright 2003 (C) James Strachan and Bob Mcwhirter. All Rights Reserved.
008:
009:
010:
011: Redistribution and use of this software and associated documentation
012:
013: ("Software"), with or without modification, are permitted provided
014:
015: that the following conditions are met:
016:
017:
018:
019: 1. Redistributions of source code must retain copyright
020:
021: statements and notices. Redistributions must also contain a
022:
023: copy of this document.
024:
025:
026:
027: 2. Redistributions in binary form must reproduce the
028:
029: above copyright notice, this list of conditions and the
030:
031: following disclaimer in the documentation and/or other
032:
033: materials provided with the distribution.
034:
035:
036:
037: 3. The name "groovy" must not be used to endorse or promote
038:
039: products derived from this Software without prior written
040:
041: permission of The Codehaus. For written permission,
042:
043: please contact info@codehaus.org.
044:
045:
046:
047: 4. Products derived from this Software may not be called "groovy"
048:
049: nor may "groovy" appear in their names without prior written
050:
051: permission of The Codehaus. "groovy" is a registered
052:
053: trademark of The Codehaus.
054:
055:
056:
057: 5. Due credit should be given to The Codehaus -
058:
059: http://groovy.codehaus.org/
060:
061:
062:
063: THIS SOFTWARE IS PROVIDED BY THE CODEHAUS AND CONTRIBUTORS
064:
065: ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT
066:
067: NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
068:
069: FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
070:
071: THE CODEHAUS OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
072:
073: INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
074:
075: (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
076:
077: SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
078:
079: HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
080:
081: STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
082:
083: ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
084:
085: OF THE POSSIBILITY OF SUCH DAMAGE.
086:
087:
088:
089: */
090:
091: package org.codehaus.groovy.ast;
092:
093: import org.codehaus.groovy.ast.expr.*;
094:
095: import org.codehaus.groovy.ast.stmt.*;
096:
097: /**
098:
099: * An implementation of the visitor pattern for working with ASTNodes
100:
101: *
102:
103: * @author <a href="mailto:james@coredevelopers.net">James Strachan</a>
104:
105: * @version $Revision: 3891 $
106:
107: */
108:
109: public interface GroovyCodeVisitor {
110:
111: // statements
112:
113: //-------------------------------------------------------------------------
114:
115: public void visitBlockStatement(BlockStatement statement);
116:
117: public void visitForLoop(ForStatement forLoop);
118:
119: public void visitWhileLoop(WhileStatement loop);
120:
121: public void visitDoWhileLoop(DoWhileStatement loop);
122:
123: public void visitIfElse(IfStatement ifElse);
124:
125: public void visitExpressionStatement(ExpressionStatement statement);
126:
127: public void visitReturnStatement(ReturnStatement statement);
128:
129: public void visitAssertStatement(AssertStatement statement);
130:
131: public void visitTryCatchFinally(TryCatchStatement finally1);
132:
133: public void visitSwitch(SwitchStatement statement);
134:
135: public void visitCaseStatement(CaseStatement statement);
136:
137: public void visitBreakStatement(BreakStatement statement);
138:
139: public void visitContinueStatement(ContinueStatement statement);
140:
141: public void visitThrowStatement(ThrowStatement statement);
142:
143: public void visitSynchronizedStatement(
144: SynchronizedStatement statement);
145:
146: public void visitCatchStatement(CatchStatement statement);
147:
148: // expressions
149:
150: //-------------------------------------------------------------------------
151:
152: public void visitMethodCallExpression(MethodCallExpression call);
153:
154: public void visitStaticMethodCallExpression(
155: StaticMethodCallExpression expression);
156:
157: public void visitConstructorCallExpression(
158: ConstructorCallExpression expression);
159:
160: public void visitTernaryExpression(TernaryExpression expression);
161:
162: public void visitBinaryExpression(BinaryExpression expression);
163:
164: public void visitPrefixExpression(PrefixExpression expression);
165:
166: public void visitPostfixExpression(PostfixExpression expression);
167:
168: public void visitBooleanExpression(BooleanExpression expression);
169:
170: public void visitClosureExpression(ClosureExpression expression);
171:
172: public void visitTupleExpression(TupleExpression expression);
173:
174: public void visitMapExpression(MapExpression expression);
175:
176: public void visitMapEntryExpression(MapEntryExpression expression);
177:
178: public void visitListExpression(ListExpression expression);
179:
180: public void visitRangeExpression(RangeExpression expression);
181:
182: public void visitPropertyExpression(PropertyExpression expression);
183:
184: public void visitAttributeExpression(
185: AttributeExpression attributeExpression);
186:
187: public void visitFieldExpression(FieldExpression expression);
188:
189: public void visitMethodPointerExpression(
190: MethodPointerExpression expression);
191:
192: public void visitConstantExpression(ConstantExpression expression);
193:
194: public void visitClassExpression(ClassExpression expression);
195:
196: public void visitVariableExpression(VariableExpression expression);
197:
198: public void visitDeclarationExpression(
199: DeclarationExpression expression);
200:
201: public void visitRegexExpression(RegexExpression expression);
202:
203: public void visitGStringExpression(GStringExpression expression);
204:
205: public void visitArrayExpression(ArrayExpression expression);
206:
207: public void visitSpreadExpression(SpreadExpression expression);
208:
209: public void visitSpreadMapExpression(SpreadMapExpression expression);
210:
211: public void visitNotExpression(NotExpression expression);
212:
213: public void visitNegationExpression(NegationExpression expression);
214:
215: public void visitBitwiseNegExpression(
216: BitwiseNegExpression expression);
217:
218: public void visitCastExpression(CastExpression expression);
219:
220: public void visitArgumentlistExpression(
221: ArgumentListExpression expression);
222: }
|