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);
92 void endVisit(AllocationExpression allocationExpression, BlockScope scope);
93 void endVisit(AND_AND_Expression and_and_Expression, BlockScope scope);
94 void endVisit(AnonymousLocalTypeDeclaration anonymousTypeDeclaration, BlockScope scope);
95 void endVisit(Argument argument, BlockScope scope);
96 void endVisit(ArrayAllocationExpression arrayAllocationExpression, BlockScope scope);
97 void endVisit(ArrayInitializer arrayInitializer, BlockScope scope);
98 void endVisit(ArrayQualifiedTypeReference arrayQualifiedTypeReference, BlockScope scope);
99 void endVisit(ArrayQualifiedTypeReference arrayQualifiedTypeReference, ClassScope scope);
100 void endVisit(ArrayReference arrayReference, BlockScope scope);
101 void endVisit(ArrayTypeReference arrayTypeReference, BlockScope scope);
102 void endVisit(ArrayTypeReference arrayTypeReference, ClassScope scope);
103 void endVisit(AssertStatement assertStatement, BlockScope scope);
104 void endVisit(Assignment assignment, BlockScope scope);
105 void endVisit(BinaryExpression binaryExpression, BlockScope scope);
106 void endVisit(Block block, BlockScope scope);
107 void endVisit(BreakStatement breakStatement, BlockScope scope);
108 void endVisit(CaseStatement caseStatement, BlockScope scope);
109 void endVisit(CastExpression castExpression, BlockScope scope);
110 // void endVisit(CharLiteral charLiteral, BlockScope scope);
111 // void endVisit(ClassLiteralAccess classLiteral, BlockScope scope);
112 void endVisit(Clinit clinit, ClassScope scope);
113 void endVisit(CompilationUnitDeclaration compilationUnitDeclaration, CompilationUnitScope scope);
114 void endVisit(CompoundAssignment compoundAssignment, BlockScope scope);
115 void endVisit(ConditionalExpression conditionalExpression, BlockScope scope);
116 void endVisit(ConstructorDeclaration constructorDeclaration, ClassScope scope);
117 void endVisit(ContinueStatement continueStatement, BlockScope scope);
118 void endVisit(DefaultCase defaultCaseStatement, BlockScope scope);
119 void endVisit(DoStatement doStatement, BlockScope scope);
120 void endVisit(DoubleLiteral doubleLiteral, BlockScope scope);
121 void endVisit(EqualExpression equalExpression, BlockScope scope);
122 void endVisit(EmptyStatement statement, BlockScope scope);
123 void endVisit(ExplicitConstructorCall explicitConstructor, BlockScope scope);
124 void endVisit(ExtendedStringLiteral extendedStringLiteral, BlockScope scope);
125 void endVisit(FalseLiteral falseLiteral, BlockScope scope);
126 void endVisit(FieldDeclaration fieldDeclaration, MethodScope scope);
127 void endVisit(FieldReference fieldReference, BlockScope scope);
128 void endVisit(FloatLiteral floatLiteral, BlockScope scope);
129 void endVisit(ForStatement forStatement, BlockScope scope);
130 void endVisit(IfStatement ifStatement, BlockScope scope);
131 void endVisit(ImportReference importRef, CompilationUnitScope scope);
132 void endVisit(Initializer initializer, MethodScope scope);
133 void endVisit(InstanceOfExpression instanceOfExpression, BlockScope scope);
134 void endVisit(IntLiteral intLiteral, BlockScope scope);
135 void endVisit(LabeledStatement labeledStatement, BlockScope scope);
136 void endVisit(LocalDeclaration localDeclaration, BlockScope scope);
137 void endVisit(LocalTypeDeclaration localTypeDeclaration, BlockScope scope);
138 void endVisit(LongLiteral longLiteral, BlockScope scope);
139 void endVisit(MemberTypeDeclaration memberTypeDeclaration, ClassScope scope);
140 void endVisit(MessageSend messageSend, BlockScope scope);
141 void endVisit(MethodDeclaration methodDeclaration, ClassScope scope);
142 void endVisit(NullLiteral nullLiteral, BlockScope scope);
143 void endVisit(OR_OR_Expression or_or_Expression, BlockScope scope);
144 void endVisit(PostfixExpression postfixExpression, BlockScope scope);
145 void endVisit(PrefixExpression prefixExpression, BlockScope scope);
146 void endVisit(QualifiedAllocationExpression qualifiedAllocationExpression, BlockScope scope);
147 void endVisit(QualifiedNameReference qualifiedNameReference, BlockScope scope);
148 void endVisit(QualifiedSuperReference qualifiedSuperReference, BlockScope scope);
149 void endVisit(QualifiedThisReference qualifiedThisReference, BlockScope scope);
150 void endVisit(QualifiedTypeReference qualifiedTypeReference, BlockScope scope);
151 void endVisit(QualifiedTypeReference qualifiedTypeReference, ClassScope scope);
152 void endVisit(ReturnStatement returnStatement, BlockScope scope);
153 void endVisit(SingleNameReference singleNameReference, BlockScope scope);
154 void endVisit(SingleTypeReference singleTypeReference, BlockScope scope);
155 void endVisit(SingleTypeReference singleTypeReference, ClassScope scope);
156 void endVisit(StringLiteral stringLiteral, BlockScope scope);
157 void endVisit(SuperReference superReference, BlockScope scope);
158 void endVisit(SwitchStatement switchStatement, BlockScope scope);
159 // void endVisit(SynchronizedStatement synchronizedStatement, BlockScope scope);
160 void endVisit(ThisReference thisReference, BlockScope scope);
161 void endVisit(ThrowStatement throwStatement, BlockScope scope);
162 void endVisit(TrueLiteral trueLiteral, BlockScope scope);
163 void endVisit(TryStatement tryStatement, BlockScope scope);
164 void endVisit(TypeDeclaration typeDeclaration, CompilationUnitScope scope);
165 void endVisit(UnaryExpression unaryExpression, BlockScope scope);
166 void endVisit(WhileStatement whileStatement, BlockScope scope);
167 boolean visit(AllocationExpression allocationExpression, BlockScope scope);
168 boolean visit(AND_AND_Expression and_and_Expression, BlockScope scope);
169 boolean visit(AnonymousLocalTypeDeclaration anonymousTypeDeclaration, BlockScope scope);
170 boolean visit(Argument argument, BlockScope scope);
171 boolean visit(ArrayAllocationExpression arrayAllocationExpression, BlockScope scope);
172 boolean visit(ArrayInitializer arrayInitializer, BlockScope scope);
173 boolean visit(ArrayQualifiedTypeReference arrayQualifiedTypeReference, BlockScope scope);
174 boolean visit(ArrayQualifiedTypeReference arrayQualifiedTypeReference, ClassScope scope);
175 boolean visit(ArrayReference arrayReference, BlockScope scope);
176 boolean visit(ArrayTypeReference arrayTypeReference, BlockScope scope);
177 boolean visit(ArrayTypeReference arrayTypeReference, ClassScope scope);
178 boolean visit(AssertStatement assertStatement, BlockScope scope);
179 boolean visit(Assignment assignment, BlockScope scope);
180 boolean visit(BinaryExpression binaryExpression, BlockScope scope);
181 boolean visit(Block block, BlockScope scope);
182 boolean visit(BreakStatement breakStatement, BlockScope scope);
183 boolean visit(CaseStatement caseStatement, BlockScope scope);
184 boolean visit(CastExpression castExpression, BlockScope scope);
185 // boolean visit(CharLiteral charLiteral, BlockScope scope);
186 // boolean visit(ClassLiteralAccess classLiteral, BlockScope scope);
187 boolean visit(Clinit clinit, ClassScope scope);
188 boolean visit(CompilationUnitDeclaration compilationUnitDeclaration, CompilationUnitScope scope);
189 boolean visit(CompoundAssignment compoundAssignment, BlockScope scope);
190 boolean visit(ConditionalExpression conditionalExpression, BlockScope scope);
191 boolean visit(ConstructorDeclaration constructorDeclaration, ClassScope scope);
192 boolean visit(ContinueStatement continueStatement, BlockScope scope);
193 boolean visit(DefaultCase defaultCaseStatement, BlockScope scope);
194 boolean visit(DoStatement doStatement, BlockScope scope);
195 boolean visit(DoubleLiteral doubleLiteral, BlockScope scope);
196 boolean visit(EqualExpression equalExpression, BlockScope scope);
197 boolean visit(EmptyStatement statement, BlockScope scope);
198 boolean visit(ExplicitConstructorCall explicitConstructor, BlockScope scope);
199 boolean visit(ExtendedStringLiteral extendedStringLiteral, BlockScope scope);
200 boolean visit(FalseLiteral falseLiteral, BlockScope scope);
201 boolean visit(FieldDeclaration fieldDeclaration, MethodScope scope);
202 boolean visit(FieldReference fieldReference, BlockScope scope);
203 boolean visit(FloatLiteral floatLiteral, BlockScope scope);
204 boolean visit(ForStatement forStatement, BlockScope scope);
205 boolean visit(IfStatement ifStatement, BlockScope scope);
206 boolean visit(ImportReference importRef, CompilationUnitScope scope);
207 boolean visit(Initializer initializer, MethodScope scope);
208 boolean visit(InstanceOfExpression instanceOfExpression, BlockScope scope);
209 boolean visit(IntLiteral intLiteral, BlockScope scope);
210 boolean visit(LabeledStatement labeledStatement, BlockScope scope);
211 boolean visit(LocalDeclaration localDeclaration, BlockScope scope);
212 boolean visit(LocalTypeDeclaration localTypeDeclaration, BlockScope scope);
213 boolean visit(LongLiteral longLiteral, BlockScope scope);
214 boolean visit(MemberTypeDeclaration memberTypeDeclaration, ClassScope scope);
215 boolean visit(MessageSend messageSend, BlockScope scope);
216 boolean visit(MethodDeclaration methodDeclaration, ClassScope scope);
217 boolean visit(NullLiteral nullLiteral, BlockScope scope);
218 boolean visit(OR_OR_Expression or_or_Expression, BlockScope scope);
219 boolean visit(PostfixExpression postfixExpression, BlockScope scope);
220 boolean visit(PrefixExpression prefixExpression, BlockScope scope);
221 boolean visit(QualifiedAllocationExpression qualifiedAllocationExpression, BlockScope scope);
222 boolean visit(QualifiedNameReference qualifiedNameReference, BlockScope scope);
223 boolean visit(QualifiedSuperReference qualifiedSuperReference, BlockScope scope);
224 boolean visit(QualifiedThisReference qualifiedThisReference, BlockScope scope);
225 boolean visit(QualifiedTypeReference qualifiedTypeReference, BlockScope scope);
226 boolean visit(QualifiedTypeReference qualifiedTypeReference, ClassScope scope);
227 boolean visit(ReturnStatement returnStatement, BlockScope scope);
228 boolean visit(SingleNameReference singleNameReference, BlockScope scope);
229 boolean visit(SingleTypeReference singleTypeReference, BlockScope scope);
230 boolean visit(SingleTypeReference singleTypeReference, ClassScope scope);
231 boolean visit(StringLiteral stringLiteral, BlockScope scope);
232 boolean visit(SuperReference superReference, BlockScope scope);
233 boolean visit(SwitchStatement switchStatement, BlockScope scope);
234 // boolean visit(SynchronizedStatement synchronizedStatement, BlockScope scope);
235 boolean visit(ThisReference thisReference, BlockScope scope);
236 boolean visit(ThrowStatement throwStatement, BlockScope scope);
237 boolean visit(TrueLiteral trueLiteral, BlockScope scope);
238 boolean visit(TryStatement tryStatement, BlockScope scope);
239 boolean visit(TypeDeclaration typeDeclaration, CompilationUnitScope scope);
240 boolean visit(UnaryExpression unaryExpression, BlockScope scope);
241 boolean visit(WhileStatement whileStatement, BlockScope scope);