fixed NPE in Parser ( function catch() )
[phpeclipse.git] / net.sourceforge.phpeclipse / src / net / sourceforge / phpdt / internal / compiler / IAbstractSyntaxTreeVisitor.java
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
7  * 
8  * Contributors:
9  *     IBM Corporation - initial API and implementation
10  *******************************************************************************/
11 package net.sourceforge.phpdt.internal.compiler;
12
13 import net.sourceforge.phpdt.core.compiler.IProblem;
14 import net.sourceforge.phpdt.internal.compiler.lookup.BlockScope;
15 import net.sourceforge.phpdt.internal.compiler.lookup.ClassScope;
16 import net.sourceforge.phpdt.internal.compiler.lookup.CompilationUnitScope;
17 import net.sourceforge.phpdt.internal.compiler.lookup.MethodScope;
18 import net.sourceforge.phpeclipse.internal.compiler.ast.AND_AND_Expression;
19 import net.sourceforge.phpeclipse.internal.compiler.ast.AllocationExpression;
20 import net.sourceforge.phpeclipse.internal.compiler.ast.AnonymousLocalTypeDeclaration;
21 import net.sourceforge.phpeclipse.internal.compiler.ast.Argument;
22 import net.sourceforge.phpeclipse.internal.compiler.ast.ArrayAllocationExpression;
23 import net.sourceforge.phpeclipse.internal.compiler.ast.ArrayInitializer;
24 import net.sourceforge.phpeclipse.internal.compiler.ast.ArrayQualifiedTypeReference;
25 import net.sourceforge.phpeclipse.internal.compiler.ast.ArrayReference;
26 import net.sourceforge.phpeclipse.internal.compiler.ast.ArrayTypeReference;
27 import net.sourceforge.phpeclipse.internal.compiler.ast.AssertStatement;
28 import net.sourceforge.phpeclipse.internal.compiler.ast.Assignment;
29 import net.sourceforge.phpeclipse.internal.compiler.ast.BinaryExpression;
30 import net.sourceforge.phpeclipse.internal.compiler.ast.Block;
31 import net.sourceforge.phpeclipse.internal.compiler.ast.Break;
32 import net.sourceforge.phpeclipse.internal.compiler.ast.Case;
33 import net.sourceforge.phpeclipse.internal.compiler.ast.CastExpression;
34 import net.sourceforge.phpeclipse.internal.compiler.ast.CharLiteral;
35 import net.sourceforge.phpeclipse.internal.compiler.ast.ClassLiteralAccess;
36 import net.sourceforge.phpeclipse.internal.compiler.ast.Clinit;
37 import net.sourceforge.phpeclipse.internal.compiler.ast.CompilationUnitDeclaration;
38 import net.sourceforge.phpeclipse.internal.compiler.ast.CompoundAssignment;
39 import net.sourceforge.phpeclipse.internal.compiler.ast.ConditionalExpression;
40 import net.sourceforge.phpeclipse.internal.compiler.ast.ConstructorDeclaration;
41 import net.sourceforge.phpeclipse.internal.compiler.ast.Continue;
42 import net.sourceforge.phpeclipse.internal.compiler.ast.DefaultCase;
43 import net.sourceforge.phpeclipse.internal.compiler.ast.DoStatement;
44 import net.sourceforge.phpeclipse.internal.compiler.ast.DoubleLiteral;
45 import net.sourceforge.phpeclipse.internal.compiler.ast.EmptyStatement;
46 import net.sourceforge.phpeclipse.internal.compiler.ast.EqualExpression;
47 import net.sourceforge.phpeclipse.internal.compiler.ast.ExplicitConstructorCall;
48 import net.sourceforge.phpeclipse.internal.compiler.ast.ExtendedStringLiteral;
49 import net.sourceforge.phpeclipse.internal.compiler.ast.FalseLiteral;
50 import net.sourceforge.phpeclipse.internal.compiler.ast.FieldDeclaration;
51 import net.sourceforge.phpeclipse.internal.compiler.ast.FieldReference;
52 import net.sourceforge.phpeclipse.internal.compiler.ast.FloatLiteral;
53 import net.sourceforge.phpeclipse.internal.compiler.ast.ForStatement;
54 import net.sourceforge.phpeclipse.internal.compiler.ast.IfStatement;
55 import net.sourceforge.phpeclipse.internal.compiler.ast.ImportReference;
56 import net.sourceforge.phpeclipse.internal.compiler.ast.Initializer;
57 import net.sourceforge.phpeclipse.internal.compiler.ast.InstanceOfExpression;
58 import net.sourceforge.phpeclipse.internal.compiler.ast.IntLiteral;
59 import net.sourceforge.phpeclipse.internal.compiler.ast.LabeledStatement;
60 import net.sourceforge.phpeclipse.internal.compiler.ast.LocalDeclaration;
61 import net.sourceforge.phpeclipse.internal.compiler.ast.LocalTypeDeclaration;
62 import net.sourceforge.phpeclipse.internal.compiler.ast.LongLiteral;
63 import net.sourceforge.phpeclipse.internal.compiler.ast.MemberTypeDeclaration;
64 import net.sourceforge.phpeclipse.internal.compiler.ast.MessageSend;
65 import net.sourceforge.phpeclipse.internal.compiler.ast.MethodDeclaration;
66 import net.sourceforge.phpeclipse.internal.compiler.ast.NullLiteral;
67 import net.sourceforge.phpeclipse.internal.compiler.ast.OR_OR_Expression;
68 import net.sourceforge.phpeclipse.internal.compiler.ast.PostfixExpression;
69 import net.sourceforge.phpeclipse.internal.compiler.ast.PrefixExpression;
70 import net.sourceforge.phpeclipse.internal.compiler.ast.QualifiedAllocationExpression;
71 import net.sourceforge.phpeclipse.internal.compiler.ast.QualifiedNameReference;
72 import net.sourceforge.phpeclipse.internal.compiler.ast.QualifiedSuperReference;
73 import net.sourceforge.phpeclipse.internal.compiler.ast.QualifiedThisReference;
74 import net.sourceforge.phpeclipse.internal.compiler.ast.QualifiedTypeReference;
75 import net.sourceforge.phpeclipse.internal.compiler.ast.ReturnStatement;
76 import net.sourceforge.phpeclipse.internal.compiler.ast.SingleNameReference;
77 import net.sourceforge.phpeclipse.internal.compiler.ast.SingleTypeReference;
78 import net.sourceforge.phpeclipse.internal.compiler.ast.StringLiteral;
79 import net.sourceforge.phpeclipse.internal.compiler.ast.SuperReference;
80 import net.sourceforge.phpeclipse.internal.compiler.ast.SwitchStatement;
81 import net.sourceforge.phpeclipse.internal.compiler.ast.SynchronizedStatement;
82 import net.sourceforge.phpeclipse.internal.compiler.ast.ThisReference;
83 import net.sourceforge.phpeclipse.internal.compiler.ast.ThrowStatement;
84 import net.sourceforge.phpeclipse.internal.compiler.ast.TrueLiteral;
85 import net.sourceforge.phpeclipse.internal.compiler.ast.TryStatement;
86 import net.sourceforge.phpeclipse.internal.compiler.ast.TypeDeclaration;
87 import net.sourceforge.phpeclipse.internal.compiler.ast.UnaryExpression;
88 import net.sourceforge.phpeclipse.internal.compiler.ast.WhileStatement;
89
90 /**
91  * A visitor interface for interating through the parse tree.
92  */
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);
245 }