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 * An adapter class for interating through the parse tree.
94 public class AbstractSyntaxTreeVisitorAdapter implements IAbstractSyntaxTreeVisitor {
96 public void acceptProblem(IProblem problem) {}
98 AllocationExpression allocationExpression,
101 public void endVisit(AND_AND_Expression and_and_Expression, BlockScope scope) {
103 public void endVisit(
104 AnonymousLocalTypeDeclaration anonymousTypeDeclaration,
107 public void endVisit(Argument argument, BlockScope scope) {
109 public void endVisit(
110 ArrayAllocationExpression arrayAllocationExpression,
113 public void endVisit(ArrayInitializer arrayInitializer, BlockScope scope) {
115 public void endVisit(
116 ArrayQualifiedTypeReference arrayQualifiedTypeReference,
119 public void endVisit(
120 ArrayQualifiedTypeReference arrayQualifiedTypeReference,
123 public void endVisit(ArrayReference arrayReference, BlockScope scope) {
125 public void endVisit(ArrayTypeReference arrayTypeReference, BlockScope scope) {
127 public void endVisit(ArrayTypeReference arrayTypeReference, ClassScope scope) {
129 public void endVisit(Assignment assignment, BlockScope scope) {
131 public void endVisit(AssertStatement assertStatement, BlockScope scope) {
133 public void endVisit(BinaryExpression binaryExpression, BlockScope scope) {
135 public void endVisit(Block block, BlockScope scope) {
137 public void endVisit(Break breakStatement, BlockScope scope) {
139 public void endVisit(Case caseStatement, BlockScope scope) {
141 public void endVisit(CastExpression castExpression, BlockScope scope) {
143 public void endVisit(CharLiteral charLiteral, BlockScope scope) {
145 public void endVisit(ClassLiteralAccess classLiteral, BlockScope scope) {
147 public void endVisit(Clinit clinit, ClassScope scope) {
149 public void endVisit(
150 CompilationUnitDeclaration compilationUnitDeclaration,
151 CompilationUnitScope scope) {
153 public void endVisit(CompoundAssignment compoundAssignment, BlockScope scope) {
155 public void endVisit(
156 ConditionalExpression conditionalExpression,
159 public void endVisit(
160 ConstructorDeclaration constructorDeclaration,
163 public void endVisit(Continue continueStatement, BlockScope scope) {
165 public void endVisit(DefaultCase defaultCaseStatement, BlockScope scope) {
167 public void endVisit(DoStatement doStatement, BlockScope scope) {
169 public void endVisit(DoubleLiteral doubleLiteral, BlockScope scope) {
171 public void endVisit(EqualExpression equalExpression, BlockScope scope) {
173 public void endVisit(
174 ExplicitConstructorCall explicitConstructor,
177 public void endVisit(
178 ExtendedStringLiteral extendedStringLiteral,
181 public void endVisit(FalseLiteral falseLiteral, BlockScope scope) {
183 public void endVisit(FieldDeclaration fieldDeclaration, MethodScope scope) {
185 public void endVisit(FieldReference fieldReference, BlockScope scope) {
187 public void endVisit(FloatLiteral floatLiteral, BlockScope scope) {
189 public void endVisit(EmptyStatement emptyStatement, BlockScope scope) {
191 public void endVisit(ForStatement forStatement, BlockScope scope) {
193 public void endVisit(IfStatement ifStatement, BlockScope scope) {
195 public void endVisit(ImportReference importRef, CompilationUnitScope scope) {
197 public void endVisit(Initializer initializer, MethodScope scope) {
199 public void endVisit(
200 InstanceOfExpression instanceOfExpression,
203 public void endVisit(IntLiteral intLiteral, BlockScope scope) {
205 public void endVisit(LabeledStatement labeledStatement, BlockScope scope) {
207 public void endVisit(LocalDeclaration localDeclaration, BlockScope scope) {
209 public void endVisit(LongLiteral longLiteral, BlockScope scope) {
211 public void endVisit(
212 MemberTypeDeclaration memberTypeDeclaration,
215 public void endVisit(MessageSend messageSend, BlockScope scope) {
217 public void endVisit(MethodDeclaration methodDeclaration, ClassScope scope) {
219 public void endVisit(NullLiteral nullLiteral, BlockScope scope) {
221 public void endVisit(OR_OR_Expression or_or_Expression, BlockScope scope) {
223 public void endVisit(PostfixExpression postfixExpression, BlockScope scope) {
225 public void endVisit(PrefixExpression prefixExpression, BlockScope scope) {
227 public void endVisit(
228 QualifiedAllocationExpression qualifiedAllocationExpression,
231 public void endVisit(
232 QualifiedNameReference qualifiedNameReference,
235 public void endVisit(
236 QualifiedSuperReference qualifiedSuperReference,
239 public void endVisit(
240 QualifiedThisReference qualifiedThisReference,
243 public void endVisit(
244 QualifiedTypeReference qualifiedTypeReference,
247 public void endVisit(
248 QualifiedTypeReference qualifiedTypeReference,
251 public void endVisit(ReturnStatement returnStatement, BlockScope scope) {
253 public void endVisit(
254 SingleNameReference singleNameReference,
257 public void endVisit(
258 SingleTypeReference singleTypeReference,
261 public void endVisit(
262 SingleTypeReference singleTypeReference,
265 public void endVisit(StringLiteral stringLiteral, BlockScope scope) {
267 public void endVisit(SuperReference superReference, BlockScope scope) {
269 public void endVisit(SwitchStatement switchStatement, BlockScope scope) {
271 public void endVisit(
272 SynchronizedStatement synchronizedStatement,
275 public void endVisit(ThisReference thisReference, BlockScope scope) {
277 public void endVisit(ThrowStatement throwStatement, BlockScope scope) {
279 public void endVisit(TrueLiteral trueLiteral, BlockScope scope) {
281 public void endVisit(TryStatement tryStatement, BlockScope scope) {
283 public void endVisit(
284 TypeDeclaration typeDeclaration,
285 CompilationUnitScope scope) {
287 public void endVisit(UnaryExpression unaryExpression, BlockScope scope) {
289 public void endVisit(WhileStatement whileStatement, BlockScope scope) {
291 public boolean visit(
292 AllocationExpression allocationExpression,
296 public boolean visit(AND_AND_Expression and_and_Expression, BlockScope scope) {
299 public boolean visit(
300 AnonymousLocalTypeDeclaration anonymousTypeDeclaration,
304 public boolean visit(Argument argument, BlockScope scope) {
307 public boolean visit(
308 ArrayAllocationExpression arrayAllocationExpression,
312 public boolean visit(ArrayInitializer arrayInitializer, BlockScope scope) {
315 public boolean visit(
316 ArrayQualifiedTypeReference arrayQualifiedTypeReference,
320 public boolean visit(
321 ArrayQualifiedTypeReference arrayQualifiedTypeReference,
325 public boolean visit(ArrayReference arrayReference, BlockScope scope) {
328 public boolean visit(ArrayTypeReference arrayTypeReference, BlockScope scope) {
331 public boolean visit(ArrayTypeReference arrayTypeReference, ClassScope scope) {
334 public boolean visit(Assignment assignment, BlockScope scope) {
337 public boolean visit(AssertStatement assertStatement, BlockScope scope) {
340 public boolean visit(BinaryExpression binaryExpression, BlockScope scope) {
343 public boolean visit(Block block, BlockScope scope) {
346 public boolean visit(Break breakStatement, BlockScope scope) {
349 public boolean visit(Case caseStatement, BlockScope scope) {
352 public boolean visit(CastExpression castExpression, BlockScope scope) {
355 public boolean visit(CharLiteral charLiteral, BlockScope scope) {
358 public boolean visit(ClassLiteralAccess classLiteral, BlockScope scope) {
361 public boolean visit(Clinit clinit, ClassScope scope) {
364 public boolean visit(
365 CompilationUnitDeclaration compilationUnitDeclaration,
366 CompilationUnitScope scope) {
369 public boolean visit(CompoundAssignment compoundAssignment, BlockScope scope) {
372 public boolean visit(
373 ConditionalExpression conditionalExpression,
377 public boolean visit(
378 ConstructorDeclaration constructorDeclaration,
382 public boolean visit(Continue continueStatement, BlockScope scope) {
385 public boolean visit(DefaultCase defaultCaseStatement, BlockScope scope) {
388 public boolean visit(DoStatement doStatement, BlockScope scope) {
391 public boolean visit(DoubleLiteral doubleLiteral, BlockScope scope) {
394 public boolean visit(EqualExpression equalExpression, BlockScope scope) {
397 public boolean visit(EmptyStatement emptyStatement, BlockScope scope) {
400 public boolean visit(
401 ExplicitConstructorCall explicitConstructor,
405 public boolean visit(
406 ExtendedStringLiteral extendedStringLiteral,
410 public boolean visit(FalseLiteral falseLiteral, BlockScope scope) {
413 public boolean visit(FieldDeclaration fieldDeclaration, MethodScope scope) {
416 public boolean visit(FieldReference fieldReference, BlockScope scope) {
419 public boolean visit(FloatLiteral floatLiteral, BlockScope scope) {
422 public boolean visit(ForStatement forStatement, BlockScope scope) {
425 public boolean visit(IfStatement ifStatement, BlockScope scope) {
428 public boolean visit(ImportReference importRef, CompilationUnitScope scope) {
431 public boolean visit(Initializer initializer, MethodScope scope) {
434 public boolean visit(
435 InstanceOfExpression instanceOfExpression,
439 public boolean visit(IntLiteral intLiteral, BlockScope scope) {
442 public boolean visit(LabeledStatement labeledStatement, BlockScope scope) {
445 public boolean visit(LocalDeclaration localDeclaration, BlockScope scope) {
448 public boolean visit(LongLiteral longLiteral, BlockScope scope) {
451 public boolean visit(
452 MemberTypeDeclaration memberTypeDeclaration,
456 public boolean visit(MessageSend messageSend, BlockScope scope) {
459 public boolean visit(MethodDeclaration methodDeclaration, ClassScope scope) {
462 public boolean visit(NullLiteral nullLiteral, BlockScope scope) {
465 public boolean visit(OR_OR_Expression or_or_Expression, BlockScope scope) {
468 public boolean visit(PostfixExpression postfixExpression, BlockScope scope) {
471 public boolean visit(PrefixExpression prefixExpression, BlockScope scope) {
474 public boolean visit(
475 QualifiedAllocationExpression qualifiedAllocationExpression,
479 public boolean visit(
480 QualifiedNameReference qualifiedNameReference,
484 public boolean visit(
485 QualifiedSuperReference qualifiedSuperReference,
489 public boolean visit(
490 QualifiedThisReference qualifiedThisReference,
494 public boolean visit(
495 QualifiedTypeReference qualifiedTypeReference,
499 public boolean visit(
500 QualifiedTypeReference qualifiedTypeReference,
504 public boolean visit(ReturnStatement returnStatement, BlockScope scope) {
507 public boolean visit(
508 SingleNameReference singleNameReference,
512 public boolean visit(
513 SingleTypeReference singleTypeReference,
517 public boolean visit(
518 SingleTypeReference singleTypeReference,
522 public boolean visit(StringLiteral stringLiteral, BlockScope scope) {
525 public boolean visit(SuperReference superReference, BlockScope scope) {
528 public boolean visit(SwitchStatement switchStatement, BlockScope scope) {
531 public boolean visit(
532 SynchronizedStatement synchronizedStatement,
536 public boolean visit(ThisReference thisReference, BlockScope scope) {
539 public boolean visit(ThrowStatement throwStatement, BlockScope scope) {
542 public boolean visit(TrueLiteral trueLiteral, BlockScope scope) {
545 public boolean visit(TryStatement tryStatement, BlockScope scope) {
548 public boolean visit(
549 TypeDeclaration typeDeclaration,
550 CompilationUnitScope scope) {
553 public boolean visit(UnaryExpression unaryExpression, BlockScope scope) {
556 public boolean visit(WhileStatement whileStatement, BlockScope scope) {
559 public boolean visit(
560 LocalTypeDeclaration localTypeDeclaration,
564 public void endVisit(
565 LocalTypeDeclaration localTypeDeclaration,