1 /*******************************************************************************
2 * Copyright (c) 2000, 2003 IBM Corporation and others.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Common Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/cpl-v10.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.BreakStatement;
28 import net.sourceforge.phpdt.internal.compiler.ast.CaseStatement;
29 import net.sourceforge.phpdt.internal.compiler.ast.CastExpression;
30 import net.sourceforge.phpdt.internal.compiler.ast.Clinit;
31 import net.sourceforge.phpdt.internal.compiler.ast.CompilationUnitDeclaration;
32 import net.sourceforge.phpdt.internal.compiler.ast.CompoundAssignment;
33 import net.sourceforge.phpdt.internal.compiler.ast.ConditionalExpression;
34 import net.sourceforge.phpdt.internal.compiler.ast.ConstructorDeclaration;
35 import net.sourceforge.phpdt.internal.compiler.ast.ContinueStatement;
36 import net.sourceforge.phpdt.internal.compiler.ast.DefaultCase;
37 import net.sourceforge.phpdt.internal.compiler.ast.DoStatement;
38 import net.sourceforge.phpdt.internal.compiler.ast.DoubleLiteral;
39 import net.sourceforge.phpdt.internal.compiler.ast.EmptyStatement;
40 import net.sourceforge.phpdt.internal.compiler.ast.EqualExpression;
41 import net.sourceforge.phpdt.internal.compiler.ast.ExplicitConstructorCall;
42 import net.sourceforge.phpdt.internal.compiler.ast.ExtendedStringLiteral;
43 import net.sourceforge.phpdt.internal.compiler.ast.FalseLiteral;
44 import net.sourceforge.phpdt.internal.compiler.ast.FieldDeclaration;
45 import net.sourceforge.phpdt.internal.compiler.ast.FieldReference;
46 import net.sourceforge.phpdt.internal.compiler.ast.FloatLiteral;
47 import net.sourceforge.phpdt.internal.compiler.ast.ForStatement;
48 import net.sourceforge.phpdt.internal.compiler.ast.IfStatement;
49 import net.sourceforge.phpdt.internal.compiler.ast.ImportReference;
50 import net.sourceforge.phpdt.internal.compiler.ast.Initializer;
51 import net.sourceforge.phpdt.internal.compiler.ast.InstanceOfExpression;
52 import net.sourceforge.phpdt.internal.compiler.ast.IntLiteral;
53 import net.sourceforge.phpdt.internal.compiler.ast.LabeledStatement;
54 import net.sourceforge.phpdt.internal.compiler.ast.LocalDeclaration;
55 import net.sourceforge.phpdt.internal.compiler.ast.LocalTypeDeclaration;
56 import net.sourceforge.phpdt.internal.compiler.ast.LongLiteral;
57 import net.sourceforge.phpdt.internal.compiler.ast.MemberTypeDeclaration;
58 import net.sourceforge.phpdt.internal.compiler.ast.MessageSend;
59 import net.sourceforge.phpdt.internal.compiler.ast.MethodDeclaration;
60 import net.sourceforge.phpdt.internal.compiler.ast.NullLiteral;
61 import net.sourceforge.phpdt.internal.compiler.ast.OR_OR_Expression;
62 import net.sourceforge.phpdt.internal.compiler.ast.PostfixExpression;
63 import net.sourceforge.phpdt.internal.compiler.ast.PrefixExpression;
64 import net.sourceforge.phpdt.internal.compiler.ast.QualifiedAllocationExpression;
65 import net.sourceforge.phpdt.internal.compiler.ast.QualifiedNameReference;
66 import net.sourceforge.phpdt.internal.compiler.ast.QualifiedSuperReference;
67 import net.sourceforge.phpdt.internal.compiler.ast.QualifiedThisReference;
68 import net.sourceforge.phpdt.internal.compiler.ast.QualifiedTypeReference;
69 import net.sourceforge.phpdt.internal.compiler.ast.ReturnStatement;
70 import net.sourceforge.phpdt.internal.compiler.ast.SingleNameReference;
71 import net.sourceforge.phpdt.internal.compiler.ast.SingleTypeReference;
72 import net.sourceforge.phpdt.internal.compiler.ast.StringLiteral;
73 import net.sourceforge.phpdt.internal.compiler.ast.SuperReference;
74 import net.sourceforge.phpdt.internal.compiler.ast.SwitchStatement;
75 import net.sourceforge.phpdt.internal.compiler.ast.ThisReference;
76 import net.sourceforge.phpdt.internal.compiler.ast.ThrowStatement;
77 import net.sourceforge.phpdt.internal.compiler.ast.TrueLiteral;
78 import net.sourceforge.phpdt.internal.compiler.ast.TryStatement;
79 import net.sourceforge.phpdt.internal.compiler.ast.TypeDeclaration;
80 import net.sourceforge.phpdt.internal.compiler.ast.UnaryExpression;
81 import net.sourceforge.phpdt.internal.compiler.ast.WhileStatement;
82 import net.sourceforge.phpdt.internal.compiler.lookup.BlockScope;
83 import net.sourceforge.phpdt.internal.compiler.lookup.ClassScope;
84 import net.sourceforge.phpdt.internal.compiler.lookup.CompilationUnitScope;
85 import net.sourceforge.phpdt.internal.compiler.lookup.MethodScope;
88 * A visitor interface for interating through the parse tree.
90 public interface IAbstractSyntaxTreeVisitor {
91 void acceptProblem(IProblem problem);
93 void endVisit(AllocationExpression allocationExpression, BlockScope scope);
95 void endVisit(AND_AND_Expression and_and_Expression, BlockScope scope);
97 void endVisit(AnonymousLocalTypeDeclaration anonymousTypeDeclaration,
100 void endVisit(Argument argument, BlockScope scope);
102 void endVisit(ArrayAllocationExpression arrayAllocationExpression,
105 void endVisit(ArrayInitializer arrayInitializer, BlockScope scope);
107 void endVisit(ArrayQualifiedTypeReference arrayQualifiedTypeReference,
110 void endVisit(ArrayQualifiedTypeReference arrayQualifiedTypeReference,
113 void endVisit(ArrayReference arrayReference, BlockScope scope);
115 void endVisit(ArrayTypeReference arrayTypeReference, BlockScope scope);
117 void endVisit(ArrayTypeReference arrayTypeReference, ClassScope scope);
119 void endVisit(AssertStatement assertStatement, BlockScope scope);
121 void endVisit(Assignment assignment, BlockScope scope);
123 void endVisit(BinaryExpression binaryExpression, BlockScope scope);
125 void endVisit(Block block, BlockScope scope);
127 void endVisit(BreakStatement breakStatement, BlockScope scope);
129 void endVisit(CaseStatement caseStatement, BlockScope scope);
131 void endVisit(CastExpression castExpression, BlockScope scope);
133 // void endVisit(CharLiteral charLiteral, BlockScope scope);
134 // void endVisit(ClassLiteralAccess classLiteral, BlockScope scope);
135 void endVisit(Clinit clinit, ClassScope scope);
137 void endVisit(CompilationUnitDeclaration compilationUnitDeclaration,
138 CompilationUnitScope scope);
140 void endVisit(CompoundAssignment compoundAssignment, BlockScope scope);
142 void endVisit(ConditionalExpression conditionalExpression, BlockScope scope);
144 void endVisit(ConstructorDeclaration constructorDeclaration,
147 void endVisit(ContinueStatement continueStatement, BlockScope scope);
149 void endVisit(DefaultCase defaultCaseStatement, BlockScope scope);
151 void endVisit(DoStatement doStatement, BlockScope scope);
153 void endVisit(DoubleLiteral doubleLiteral, BlockScope scope);
155 void endVisit(EqualExpression equalExpression, BlockScope scope);
157 void endVisit(EmptyStatement statement, BlockScope scope);
159 void endVisit(ExplicitConstructorCall explicitConstructor, BlockScope scope);
161 void endVisit(ExtendedStringLiteral extendedStringLiteral, BlockScope scope);
163 void endVisit(FalseLiteral falseLiteral, BlockScope scope);
165 void endVisit(FieldDeclaration fieldDeclaration, MethodScope scope);
167 void endVisit(FieldReference fieldReference, BlockScope scope);
169 void endVisit(FloatLiteral floatLiteral, BlockScope scope);
171 void endVisit(ForStatement forStatement, BlockScope scope);
173 void endVisit(IfStatement ifStatement, BlockScope scope);
175 void endVisit(ImportReference importRef, CompilationUnitScope scope);
177 void endVisit(Initializer initializer, MethodScope scope);
179 void endVisit(InstanceOfExpression instanceOfExpression, BlockScope scope);
181 void endVisit(IntLiteral intLiteral, BlockScope scope);
183 void endVisit(LabeledStatement labeledStatement, BlockScope scope);
185 void endVisit(LocalDeclaration localDeclaration, BlockScope scope);
187 void endVisit(LocalTypeDeclaration localTypeDeclaration, BlockScope scope);
189 void endVisit(LongLiteral longLiteral, BlockScope scope);
191 void endVisit(MemberTypeDeclaration memberTypeDeclaration, ClassScope scope);
193 void endVisit(MessageSend messageSend, BlockScope scope);
195 void endVisit(MethodDeclaration methodDeclaration, ClassScope scope);
197 void endVisit(NullLiteral nullLiteral, BlockScope scope);
199 void endVisit(OR_OR_Expression or_or_Expression, BlockScope scope);
201 void endVisit(PostfixExpression postfixExpression, BlockScope scope);
203 void endVisit(PrefixExpression prefixExpression, BlockScope scope);
205 void endVisit(QualifiedAllocationExpression qualifiedAllocationExpression,
208 void endVisit(QualifiedNameReference qualifiedNameReference,
211 void endVisit(QualifiedSuperReference qualifiedSuperReference,
214 void endVisit(QualifiedThisReference qualifiedThisReference,
217 void endVisit(QualifiedTypeReference qualifiedTypeReference,
220 void endVisit(QualifiedTypeReference qualifiedTypeReference,
223 void endVisit(ReturnStatement returnStatement, BlockScope scope);
225 void endVisit(SingleNameReference singleNameReference, BlockScope scope);
227 void endVisit(SingleTypeReference singleTypeReference, BlockScope scope);
229 void endVisit(SingleTypeReference singleTypeReference, ClassScope scope);
231 void endVisit(StringLiteral stringLiteral, BlockScope scope);
233 void endVisit(SuperReference superReference, BlockScope scope);
235 void endVisit(SwitchStatement switchStatement, BlockScope scope);
237 // void endVisit(SynchronizedStatement synchronizedStatement, BlockScope
239 void endVisit(ThisReference thisReference, BlockScope scope);
241 void endVisit(ThrowStatement throwStatement, BlockScope scope);
243 void endVisit(TrueLiteral trueLiteral, BlockScope scope);
245 void endVisit(TryStatement tryStatement, BlockScope scope);
247 void endVisit(TypeDeclaration typeDeclaration, CompilationUnitScope scope);
249 void endVisit(UnaryExpression unaryExpression, BlockScope scope);
251 void endVisit(WhileStatement whileStatement, BlockScope scope);
253 boolean visit(AllocationExpression allocationExpression, BlockScope scope);
255 boolean visit(AND_AND_Expression and_and_Expression, BlockScope scope);
257 boolean visit(AnonymousLocalTypeDeclaration anonymousTypeDeclaration,
260 boolean visit(Argument argument, BlockScope scope);
262 boolean visit(ArrayAllocationExpression arrayAllocationExpression,
265 boolean visit(ArrayInitializer arrayInitializer, BlockScope scope);
267 boolean visit(ArrayQualifiedTypeReference arrayQualifiedTypeReference,
270 boolean visit(ArrayQualifiedTypeReference arrayQualifiedTypeReference,
273 boolean visit(ArrayReference arrayReference, BlockScope scope);
275 boolean visit(ArrayTypeReference arrayTypeReference, BlockScope scope);
277 boolean visit(ArrayTypeReference arrayTypeReference, ClassScope scope);
279 boolean visit(AssertStatement assertStatement, BlockScope scope);
281 boolean visit(Assignment assignment, BlockScope scope);
283 boolean visit(BinaryExpression binaryExpression, BlockScope scope);
285 boolean visit(Block block, BlockScope scope);
287 boolean visit(BreakStatement breakStatement, BlockScope scope);
289 boolean visit(CaseStatement caseStatement, BlockScope scope);
291 boolean visit(CastExpression castExpression, BlockScope scope);
293 // boolean visit(CharLiteral charLiteral, BlockScope scope);
294 // boolean visit(ClassLiteralAccess classLiteral, BlockScope scope);
295 boolean visit(Clinit clinit, ClassScope scope);
297 boolean visit(CompilationUnitDeclaration compilationUnitDeclaration,
298 CompilationUnitScope scope);
300 boolean visit(CompoundAssignment compoundAssignment, BlockScope scope);
302 boolean visit(ConditionalExpression conditionalExpression, BlockScope scope);
304 boolean visit(ConstructorDeclaration constructorDeclaration,
307 boolean visit(ContinueStatement continueStatement, BlockScope scope);
309 boolean visit(DefaultCase defaultCaseStatement, BlockScope scope);
311 boolean visit(DoStatement doStatement, BlockScope scope);
313 boolean visit(DoubleLiteral doubleLiteral, BlockScope scope);
315 boolean visit(EqualExpression equalExpression, BlockScope scope);
317 boolean visit(EmptyStatement statement, BlockScope scope);
319 boolean visit(ExplicitConstructorCall explicitConstructor, BlockScope scope);
321 boolean visit(ExtendedStringLiteral extendedStringLiteral, BlockScope scope);
323 boolean visit(FalseLiteral falseLiteral, BlockScope scope);
325 boolean visit(FieldDeclaration fieldDeclaration, MethodScope scope);
327 boolean visit(FieldReference fieldReference, BlockScope scope);
329 boolean visit(FloatLiteral floatLiteral, BlockScope scope);
331 boolean visit(ForStatement forStatement, BlockScope scope);
333 boolean visit(IfStatement ifStatement, BlockScope scope);
335 boolean visit(ImportReference importRef, CompilationUnitScope scope);
337 boolean visit(Initializer initializer, MethodScope scope);
339 boolean visit(InstanceOfExpression instanceOfExpression, BlockScope scope);
341 boolean visit(IntLiteral intLiteral, BlockScope scope);
343 boolean visit(LabeledStatement labeledStatement, BlockScope scope);
345 boolean visit(LocalDeclaration localDeclaration, BlockScope scope);
347 boolean visit(LocalTypeDeclaration localTypeDeclaration, BlockScope scope);
349 boolean visit(LongLiteral longLiteral, BlockScope scope);
351 boolean visit(MemberTypeDeclaration memberTypeDeclaration, ClassScope scope);
353 boolean visit(MessageSend messageSend, BlockScope scope);
355 boolean visit(MethodDeclaration methodDeclaration, ClassScope scope);
357 boolean visit(NullLiteral nullLiteral, BlockScope scope);
359 boolean visit(OR_OR_Expression or_or_Expression, BlockScope scope);
361 boolean visit(PostfixExpression postfixExpression, BlockScope scope);
363 boolean visit(PrefixExpression prefixExpression, BlockScope scope);
365 boolean visit(QualifiedAllocationExpression qualifiedAllocationExpression,
368 boolean visit(QualifiedNameReference qualifiedNameReference,
371 boolean visit(QualifiedSuperReference qualifiedSuperReference,
374 boolean visit(QualifiedThisReference qualifiedThisReference,
377 boolean visit(QualifiedTypeReference qualifiedTypeReference,
380 boolean visit(QualifiedTypeReference qualifiedTypeReference,
383 boolean visit(ReturnStatement returnStatement, BlockScope scope);
385 boolean visit(SingleNameReference singleNameReference, BlockScope scope);
387 boolean visit(SingleTypeReference singleTypeReference, BlockScope scope);
389 boolean visit(SingleTypeReference singleTypeReference, ClassScope scope);
391 boolean visit(StringLiteral stringLiteral, BlockScope scope);
393 boolean visit(SuperReference superReference, BlockScope scope);
395 boolean visit(SwitchStatement switchStatement, BlockScope scope);
397 // boolean visit(SynchronizedStatement synchronizedStatement, BlockScope
399 boolean visit(ThisReference thisReference, BlockScope scope);
401 boolean visit(ThrowStatement throwStatement, BlockScope scope);
403 boolean visit(TrueLiteral trueLiteral, BlockScope scope);
405 boolean visit(TryStatement tryStatement, BlockScope scope);
407 boolean visit(TypeDeclaration typeDeclaration, CompilationUnitScope scope);
409 boolean visit(UnaryExpression unaryExpression, BlockScope scope);
411 boolean visit(WhileStatement whileStatement, BlockScope scope);