1 /*******************************************************************************
2 * Copyright (c) 2000, 2001, 2002 International Business Machines Corp. and others.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Common Public License v0.5
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/cpl-v05.html
9 * IBM Corporation - initial API and implementation
10 ******************************************************************************/
11 package net.sourceforge.phpdt.internal.compiler;
13 import net.sourceforge.phpdt.core.compiler.IProblem;
14 import net.sourceforge.phpdt.internal.compiler.ast.AND_AND_Expression;
15 import net.sourceforge.phpdt.internal.compiler.ast.AllocationExpression;
16 import net.sourceforge.phpdt.internal.compiler.ast.AnonymousLocalTypeDeclaration;
17 import net.sourceforge.phpdt.internal.compiler.ast.Argument;
18 import net.sourceforge.phpdt.internal.compiler.ast.ArrayAllocationExpression;
19 import net.sourceforge.phpdt.internal.compiler.ast.ArrayInitializer;
20 import net.sourceforge.phpdt.internal.compiler.ast.ArrayQualifiedTypeReference;
21 import net.sourceforge.phpdt.internal.compiler.ast.ArrayReference;
22 import net.sourceforge.phpdt.internal.compiler.ast.ArrayTypeReference;
23 import net.sourceforge.phpdt.internal.compiler.ast.AssertStatement;
24 import net.sourceforge.phpdt.internal.compiler.ast.Assignment;
25 import net.sourceforge.phpdt.internal.compiler.ast.BinaryExpression;
26 import net.sourceforge.phpdt.internal.compiler.ast.Block;
27 import net.sourceforge.phpdt.internal.compiler.ast.Break;
28 import net.sourceforge.phpdt.internal.compiler.ast.Case;
29 import net.sourceforge.phpdt.internal.compiler.ast.CastExpression;
30 import net.sourceforge.phpdt.internal.compiler.ast.CharLiteral;
31 import net.sourceforge.phpdt.internal.compiler.ast.ClassLiteralAccess;
32 import net.sourceforge.phpdt.internal.compiler.ast.Clinit;
33 import net.sourceforge.phpdt.internal.compiler.ast.CompilationUnitDeclaration;
34 import net.sourceforge.phpdt.internal.compiler.ast.CompoundAssignment;
35 import net.sourceforge.phpdt.internal.compiler.ast.ConditionalExpression;
36 import net.sourceforge.phpdt.internal.compiler.ast.ConstructorDeclaration;
37 import net.sourceforge.phpdt.internal.compiler.ast.Continue;
38 import net.sourceforge.phpdt.internal.compiler.ast.DefaultCase;
39 import net.sourceforge.phpdt.internal.compiler.ast.DoStatement;
40 import net.sourceforge.phpdt.internal.compiler.ast.DoubleLiteral;
41 import net.sourceforge.phpdt.internal.compiler.ast.EmptyStatement;
42 import net.sourceforge.phpdt.internal.compiler.ast.EqualExpression;
43 import net.sourceforge.phpdt.internal.compiler.ast.ExplicitConstructorCall;
44 import net.sourceforge.phpdt.internal.compiler.ast.ExtendedStringLiteral;
45 import net.sourceforge.phpdt.internal.compiler.ast.FalseLiteral;
46 import net.sourceforge.phpdt.internal.compiler.ast.FieldDeclaration;
47 import net.sourceforge.phpdt.internal.compiler.ast.FieldReference;
48 import net.sourceforge.phpdt.internal.compiler.ast.FloatLiteral;
49 import net.sourceforge.phpdt.internal.compiler.ast.ForStatement;
50 import net.sourceforge.phpdt.internal.compiler.ast.IfStatement;
51 import net.sourceforge.phpdt.internal.compiler.ast.ImportReference;
52 import net.sourceforge.phpdt.internal.compiler.ast.Initializer;
53 import net.sourceforge.phpdt.internal.compiler.ast.InstanceOfExpression;
54 import net.sourceforge.phpdt.internal.compiler.ast.IntLiteral;
55 import net.sourceforge.phpdt.internal.compiler.ast.LabeledStatement;
56 import net.sourceforge.phpdt.internal.compiler.ast.LocalDeclaration;
57 import net.sourceforge.phpdt.internal.compiler.ast.LocalTypeDeclaration;
58 import net.sourceforge.phpdt.internal.compiler.ast.LongLiteral;
59 import net.sourceforge.phpdt.internal.compiler.ast.MemberTypeDeclaration;
60 import net.sourceforge.phpdt.internal.compiler.ast.MessageSend;
61 import net.sourceforge.phpdt.internal.compiler.ast.MethodDeclaration;
62 import net.sourceforge.phpdt.internal.compiler.ast.NullLiteral;
63 import net.sourceforge.phpdt.internal.compiler.ast.OR_OR_Expression;
64 import net.sourceforge.phpdt.internal.compiler.ast.PostfixExpression;
65 import net.sourceforge.phpdt.internal.compiler.ast.PrefixExpression;
66 import net.sourceforge.phpdt.internal.compiler.ast.QualifiedAllocationExpression;
67 import net.sourceforge.phpdt.internal.compiler.ast.QualifiedNameReference;
68 import net.sourceforge.phpdt.internal.compiler.ast.QualifiedSuperReference;
69 import net.sourceforge.phpdt.internal.compiler.ast.QualifiedThisReference;
70 import net.sourceforge.phpdt.internal.compiler.ast.QualifiedTypeReference;
71 import net.sourceforge.phpdt.internal.compiler.ast.ReturnStatement;
72 import net.sourceforge.phpdt.internal.compiler.ast.SingleNameReference;
73 import net.sourceforge.phpdt.internal.compiler.ast.SingleTypeReference;
74 import net.sourceforge.phpdt.internal.compiler.ast.StringLiteral;
75 import net.sourceforge.phpdt.internal.compiler.ast.SuperReference;
76 import net.sourceforge.phpdt.internal.compiler.ast.SwitchStatement;
77 import net.sourceforge.phpdt.internal.compiler.ast.SynchronizedStatement;
78 import net.sourceforge.phpdt.internal.compiler.ast.ThisReference;
79 import net.sourceforge.phpdt.internal.compiler.ast.ThrowStatement;
80 import net.sourceforge.phpdt.internal.compiler.ast.TrueLiteral;
81 import net.sourceforge.phpdt.internal.compiler.ast.TryStatement;
82 import net.sourceforge.phpdt.internal.compiler.ast.TypeDeclaration;
83 import net.sourceforge.phpdt.internal.compiler.ast.UnaryExpression;
84 import net.sourceforge.phpdt.internal.compiler.ast.WhileStatement;
85 import net.sourceforge.phpdt.internal.compiler.lookup.BlockScope;
86 import net.sourceforge.phpdt.internal.compiler.lookup.ClassScope;
87 import net.sourceforge.phpdt.internal.compiler.lookup.CompilationUnitScope;
88 import net.sourceforge.phpdt.internal.compiler.lookup.MethodScope;
91 * A visitor interface for interating through the parse tree.
93 public interface IAbstractSyntaxTreeVisitor {
94 void acceptProblem(IProblem problem);
95 void endVisit(AllocationExpression allocationExpression, BlockScope scope);
96 void endVisit(AND_AND_Expression and_and_Expression, BlockScope scope);
97 void endVisit(AnonymousLocalTypeDeclaration anonymousTypeDeclaration, BlockScope scope);
98 void endVisit(Argument argument, BlockScope scope);
99 void endVisit(ArrayAllocationExpression arrayAllocationExpression, BlockScope scope);
100 void endVisit(ArrayInitializer arrayInitializer, BlockScope scope);
101 void endVisit(ArrayQualifiedTypeReference arrayQualifiedTypeReference, BlockScope scope);
102 void endVisit(ArrayQualifiedTypeReference arrayQualifiedTypeReference, ClassScope scope);
103 void endVisit(ArrayReference arrayReference, BlockScope scope);
104 void endVisit(ArrayTypeReference arrayTypeReference, BlockScope scope);
105 void endVisit(ArrayTypeReference arrayTypeReference, ClassScope scope);
106 void endVisit(AssertStatement assertStatement, BlockScope scope);
107 void endVisit(Assignment assignment, BlockScope scope);
108 void endVisit(BinaryExpression binaryExpression, BlockScope scope);
109 void endVisit(Block block, BlockScope scope);
110 void endVisit(Break breakStatement, BlockScope scope);
111 void endVisit(Case caseStatement, BlockScope scope);
112 void endVisit(CastExpression castExpression, BlockScope scope);
113 void endVisit(CharLiteral charLiteral, BlockScope scope);
114 void endVisit(ClassLiteralAccess classLiteral, BlockScope scope);
115 void endVisit(Clinit clinit, ClassScope scope);
116 void endVisit(CompilationUnitDeclaration compilationUnitDeclaration, CompilationUnitScope scope);
117 void endVisit(CompoundAssignment compoundAssignment, BlockScope scope);
118 void endVisit(ConditionalExpression conditionalExpression, BlockScope scope);
119 void endVisit(ConstructorDeclaration constructorDeclaration, ClassScope scope);
120 void endVisit(Continue continueStatement, BlockScope scope);
121 void endVisit(DefaultCase defaultCaseStatement, BlockScope scope);
122 void endVisit(DoStatement doStatement, BlockScope scope);
123 void endVisit(DoubleLiteral doubleLiteral, BlockScope scope);
124 void endVisit(EqualExpression equalExpression, BlockScope scope);
125 void endVisit(EmptyStatement statement, BlockScope scope);
126 void endVisit(ExplicitConstructorCall explicitConstructor, BlockScope scope);
127 void endVisit(ExtendedStringLiteral extendedStringLiteral, BlockScope scope);
128 void endVisit(FalseLiteral falseLiteral, BlockScope scope);
129 void endVisit(FieldDeclaration fieldDeclaration, MethodScope scope);
130 void endVisit(FieldReference fieldReference, BlockScope scope);
131 void endVisit(FloatLiteral floatLiteral, BlockScope scope);
132 void endVisit(ForStatement forStatement, BlockScope scope);
133 void endVisit(IfStatement ifStatement, BlockScope scope);
134 void endVisit(ImportReference importRef, CompilationUnitScope scope);
135 void endVisit(Initializer initializer, MethodScope scope);
136 void endVisit(InstanceOfExpression instanceOfExpression, BlockScope scope);
137 void endVisit(IntLiteral intLiteral, BlockScope scope);
138 void endVisit(LabeledStatement labeledStatement, BlockScope scope);
139 void endVisit(LocalDeclaration localDeclaration, BlockScope scope);
140 void endVisit(LocalTypeDeclaration localTypeDeclaration, BlockScope scope);
141 void endVisit(LongLiteral longLiteral, BlockScope scope);
142 void endVisit(MemberTypeDeclaration memberTypeDeclaration, ClassScope scope);
143 void endVisit(MessageSend messageSend, BlockScope scope);
144 void endVisit(MethodDeclaration methodDeclaration, ClassScope scope);
145 void endVisit(NullLiteral nullLiteral, BlockScope scope);
146 void endVisit(OR_OR_Expression or_or_Expression, BlockScope scope);
147 void endVisit(PostfixExpression postfixExpression, BlockScope scope);
148 void endVisit(PrefixExpression prefixExpression, BlockScope scope);
149 void endVisit(QualifiedAllocationExpression qualifiedAllocationExpression, BlockScope scope);
150 void endVisit(QualifiedNameReference qualifiedNameReference, BlockScope scope);
151 void endVisit(QualifiedSuperReference qualifiedSuperReference, BlockScope scope);
152 void endVisit(QualifiedThisReference qualifiedThisReference, BlockScope scope);
153 void endVisit(QualifiedTypeReference qualifiedTypeReference, BlockScope scope);
154 void endVisit(QualifiedTypeReference qualifiedTypeReference, ClassScope scope);
155 void endVisit(ReturnStatement returnStatement, BlockScope scope);
156 void endVisit(SingleNameReference singleNameReference, BlockScope scope);
157 void endVisit(SingleTypeReference singleTypeReference, BlockScope scope);
158 void endVisit(SingleTypeReference singleTypeReference, ClassScope scope);
159 void endVisit(StringLiteral stringLiteral, BlockScope scope);
160 void endVisit(SuperReference superReference, BlockScope scope);
161 void endVisit(SwitchStatement switchStatement, BlockScope scope);
162 void endVisit(SynchronizedStatement synchronizedStatement, BlockScope scope);
163 void endVisit(ThisReference thisReference, BlockScope scope);
164 void endVisit(ThrowStatement throwStatement, BlockScope scope);
165 void endVisit(TrueLiteral trueLiteral, BlockScope scope);
166 void endVisit(TryStatement tryStatement, BlockScope scope);
167 void endVisit(TypeDeclaration typeDeclaration, CompilationUnitScope scope);
168 void endVisit(UnaryExpression unaryExpression, BlockScope scope);
169 void endVisit(WhileStatement whileStatement, BlockScope scope);
170 boolean visit(AllocationExpression allocationExpression, BlockScope scope);
171 boolean visit(AND_AND_Expression and_and_Expression, BlockScope scope);
172 boolean visit(AnonymousLocalTypeDeclaration anonymousTypeDeclaration, BlockScope scope);
173 boolean visit(Argument argument, BlockScope scope);
174 boolean visit(ArrayAllocationExpression arrayAllocationExpression, BlockScope scope);
175 boolean visit(ArrayInitializer arrayInitializer, BlockScope scope);
176 boolean visit(ArrayQualifiedTypeReference arrayQualifiedTypeReference, BlockScope scope);
177 boolean visit(ArrayQualifiedTypeReference arrayQualifiedTypeReference, ClassScope scope);
178 boolean visit(ArrayReference arrayReference, BlockScope scope);
179 boolean visit(ArrayTypeReference arrayTypeReference, BlockScope scope);
180 boolean visit(ArrayTypeReference arrayTypeReference, ClassScope scope);
181 boolean visit(AssertStatement assertStatement, BlockScope scope);
182 boolean visit(Assignment assignment, BlockScope scope);
183 boolean visit(BinaryExpression binaryExpression, BlockScope scope);
184 boolean visit(Block block, BlockScope scope);
185 boolean visit(Break breakStatement, BlockScope scope);
186 boolean visit(Case caseStatement, BlockScope scope);
187 boolean visit(CastExpression castExpression, BlockScope scope);
188 boolean visit(CharLiteral charLiteral, BlockScope scope);
189 boolean visit(ClassLiteralAccess classLiteral, BlockScope scope);
190 boolean visit(Clinit clinit, ClassScope scope);
191 boolean visit(CompilationUnitDeclaration compilationUnitDeclaration, CompilationUnitScope scope);
192 boolean visit(CompoundAssignment compoundAssignment, BlockScope scope);
193 boolean visit(ConditionalExpression conditionalExpression, BlockScope scope);
194 boolean visit(ConstructorDeclaration constructorDeclaration, ClassScope scope);
195 boolean visit(Continue continueStatement, BlockScope scope);
196 boolean visit(DefaultCase defaultCaseStatement, BlockScope scope);
197 boolean visit(DoStatement doStatement, BlockScope scope);
198 boolean visit(DoubleLiteral doubleLiteral, BlockScope scope);
199 boolean visit(EqualExpression equalExpression, BlockScope scope);
200 boolean visit(EmptyStatement statement, BlockScope scope);
201 boolean visit(ExplicitConstructorCall explicitConstructor, BlockScope scope);
202 boolean visit(ExtendedStringLiteral extendedStringLiteral, BlockScope scope);
203 boolean visit(FalseLiteral falseLiteral, BlockScope scope);
204 boolean visit(FieldDeclaration fieldDeclaration, MethodScope scope);
205 boolean visit(FieldReference fieldReference, BlockScope scope);
206 boolean visit(FloatLiteral floatLiteral, BlockScope scope);
207 boolean visit(ForStatement forStatement, BlockScope scope);
208 boolean visit(IfStatement ifStatement, BlockScope scope);
209 boolean visit(ImportReference importRef, CompilationUnitScope scope);
210 boolean visit(Initializer initializer, MethodScope scope);
211 boolean visit(InstanceOfExpression instanceOfExpression, BlockScope scope);
212 boolean visit(IntLiteral intLiteral, BlockScope scope);
213 boolean visit(LabeledStatement labeledStatement, BlockScope scope);
214 boolean visit(LocalDeclaration localDeclaration, BlockScope scope);
215 boolean visit(LocalTypeDeclaration localTypeDeclaration, BlockScope scope);
216 boolean visit(LongLiteral longLiteral, BlockScope scope);
217 boolean visit(MemberTypeDeclaration memberTypeDeclaration, ClassScope scope);
218 boolean visit(MessageSend messageSend, BlockScope scope);
219 boolean visit(MethodDeclaration methodDeclaration, ClassScope scope);
220 boolean visit(NullLiteral nullLiteral, BlockScope scope);
221 boolean visit(OR_OR_Expression or_or_Expression, BlockScope scope);
222 boolean visit(PostfixExpression postfixExpression, BlockScope scope);
223 boolean visit(PrefixExpression prefixExpression, BlockScope scope);
224 boolean visit(QualifiedAllocationExpression qualifiedAllocationExpression, BlockScope scope);
225 boolean visit(QualifiedNameReference qualifiedNameReference, BlockScope scope);
226 boolean visit(QualifiedSuperReference qualifiedSuperReference, BlockScope scope);
227 boolean visit(QualifiedThisReference qualifiedThisReference, BlockScope scope);
228 boolean visit(QualifiedTypeReference qualifiedTypeReference, BlockScope scope);
229 boolean visit(QualifiedTypeReference qualifiedTypeReference, ClassScope scope);
230 boolean visit(ReturnStatement returnStatement, BlockScope scope);
231 boolean visit(SingleNameReference singleNameReference, BlockScope scope);
232 boolean visit(SingleTypeReference singleTypeReference, BlockScope scope);
233 boolean visit(SingleTypeReference singleTypeReference, ClassScope scope);
234 boolean visit(StringLiteral stringLiteral, BlockScope scope);
235 boolean visit(SuperReference superReference, BlockScope scope);
236 boolean visit(SwitchStatement switchStatement, BlockScope scope);
237 boolean visit(SynchronizedStatement synchronizedStatement, BlockScope scope);
238 boolean visit(ThisReference thisReference, BlockScope scope);
239 boolean visit(ThrowStatement throwStatement, BlockScope scope);
240 boolean visit(TrueLiteral trueLiteral, BlockScope scope);
241 boolean visit(TryStatement tryStatement, BlockScope scope);
242 boolean visit(TypeDeclaration typeDeclaration, CompilationUnitScope scope);
243 boolean visit(UnaryExpression unaryExpression, BlockScope scope);
244 boolean visit(WhileStatement whileStatement, BlockScope scope);