Lines 26-31
Link Here
|
26 |
PatternLocator patternLocator; |
26 |
PatternLocator patternLocator; |
27 |
private ASTVisitor localDeclarationVisitor; |
27 |
private ASTVisitor localDeclarationVisitor; |
28 |
final int patternFineGrain; |
28 |
final int patternFineGrain; |
|
|
29 |
private MatchLocator locator; |
29 |
|
30 |
|
30 |
public static MatchLocatorParser createParser(ProblemReporter problemReporter, MatchLocator locator) { |
31 |
public static MatchLocatorParser createParser(ProblemReporter problemReporter, MatchLocator locator) { |
31 |
if ((locator.matchContainer & PatternLocator.COMPILATION_UNIT_CONTAINER) != 0) { |
32 |
if ((locator.matchContainer & PatternLocator.COMPILATION_UNIT_CONTAINER) != 0) { |
Lines 93-98
Link Here
|
93 |
protected MatchLocatorParser(ProblemReporter problemReporter, MatchLocator locator) { |
94 |
protected MatchLocatorParser(ProblemReporter problemReporter, MatchLocator locator) { |
94 |
super(problemReporter, true); |
95 |
super(problemReporter, true); |
95 |
this.reportOnlyOneSyntaxError = true; |
96 |
this.reportOnlyOneSyntaxError = true; |
|
|
97 |
this.locator = locator; |
96 |
this.patternLocator = locator.patternLocator; |
98 |
this.patternLocator = locator.patternLocator; |
97 |
if ((locator.matchContainer & PatternLocator.CLASS_CONTAINER) != 0) { |
99 |
if ((locator.matchContainer & PatternLocator.CLASS_CONTAINER) != 0) { |
98 |
this.localDeclarationVisitor = (locator.matchContainer & PatternLocator.METHOD_CONTAINER) != 0 |
100 |
this.localDeclarationVisitor = (locator.matchContainer & PatternLocator.METHOD_CONTAINER) != 0 |
Lines 209-214
Link Here
|
209 |
} |
211 |
} |
210 |
} |
212 |
} |
211 |
|
213 |
|
|
|
214 |
protected void consumeEnterAnonymousClassBody(boolean qualified) { |
215 |
this.locator.parseContext = MatchLocator.PARSE_ANONYMOUS_BODY; |
216 |
super.consumeEnterAnonymousClassBody(qualified); |
217 |
this.locator.parseContext = MatchLocator.PARSE_STATE_UNKNOWN; |
218 |
} |
219 |
|
212 |
protected void consumeCastExpressionLL1() { |
220 |
protected void consumeCastExpressionLL1() { |
213 |
super.consumeCastExpressionLL1(); |
221 |
super.consumeCastExpressionLL1(); |
214 |
if ((this.patternFineGrain & IJavaSearchConstants.CAST_TYPE_REFERENCE) != 0) { |
222 |
if ((this.patternFineGrain & IJavaSearchConstants.CAST_TYPE_REFERENCE) != 0) { |
Lines 256-266
Link Here
|
256 |
} |
264 |
} |
257 |
|
265 |
|
258 |
protected void consumeClassHeaderExtends() { |
266 |
protected void consumeClassHeaderExtends() { |
|
|
267 |
this.locator.parseContext = MatchLocator.PARSE_EXTENDS_TYPE; |
259 |
super.consumeClassHeaderExtends(); |
268 |
super.consumeClassHeaderExtends(); |
260 |
if ((this.patternFineGrain & IJavaSearchConstants.SUPERTYPE_TYPE_REFERENCE) != 0) { |
269 |
if ((this.patternFineGrain & IJavaSearchConstants.SUPERTYPE_TYPE_REFERENCE) != 0) { |
261 |
TypeDeclaration typeDeclaration = (TypeDeclaration) this.astStack[this.astPtr]; |
270 |
TypeDeclaration typeDeclaration = (TypeDeclaration) this.astStack[this.astPtr]; |
262 |
this.patternLocator.match(typeDeclaration.superclass, this.nodeSet); |
271 |
this.patternLocator.match(typeDeclaration.superclass, this.nodeSet); |
263 |
} |
272 |
} |
|
|
273 |
this.locator.parseContext = MatchLocator.PARSE_STATE_UNKNOWN; |
264 |
} |
274 |
} |
265 |
|
275 |
|
266 |
protected void consumeClassInstanceCreationExpressionQualifiedWithTypeArguments() { |
276 |
protected void consumeClassInstanceCreationExpressionQualifiedWithTypeArguments() { |
Lines 337-347
Link Here
|
337 |
} |
347 |
} |
338 |
} |
348 |
} |
339 |
protected void consumeInterfaceType() { |
349 |
protected void consumeInterfaceType() { |
|
|
350 |
this.locator.parseContext = MatchLocator.PARSE_INTERFACE_TYPE; |
340 |
super.consumeInterfaceType(); |
351 |
super.consumeInterfaceType(); |
341 |
if ((this.patternFineGrain & IJavaSearchConstants.SUPERTYPE_TYPE_REFERENCE) != 0) { |
352 |
if ((this.patternFineGrain & IJavaSearchConstants.SUPERTYPE_TYPE_REFERENCE) != 0) { |
342 |
TypeReference typeReference = (TypeReference) this.astStack[this.astPtr]; |
353 |
TypeReference typeReference = (TypeReference) this.astStack[this.astPtr]; |
343 |
this.patternLocator.match(typeReference, this.nodeSet); |
354 |
this.patternLocator.match(typeReference, this.nodeSet); |
344 |
} |
355 |
} |
|
|
356 |
this.locator.parseContext = MatchLocator.PARSE_STATE_UNKNOWN; |
345 |
} |
357 |
} |
346 |
|
358 |
|
347 |
protected void consumeLocalVariableDeclaration() { |
359 |
protected void consumeLocalVariableDeclaration() { |