diff options
author | aclement <aclement> | 2010-10-27 16:06:40 +0000 |
---|---|---|
committer | aclement <aclement> | 2010-10-27 16:06:40 +0000 |
commit | 6c3063b50f9b34b3103e738122034b81c483f7ff (patch) | |
tree | 42b22d501bb20aa0d8813776c538504e95655179 /org.aspectj.matcher | |
parent | 9c8d91a03593d28e516294f4bc47e378a6149d10 (diff) | |
download | aspectj-6c3063b50f9b34b3103e738122034b81c483f7ff.tar.gz aspectj-6c3063b50f9b34b3103e738122034b81c483f7ff.zip |
328840
Diffstat (limited to 'org.aspectj.matcher')
-rw-r--r-- | org.aspectj.matcher/src/org/aspectj/weaver/patterns/PatternParser.java | 35 |
1 files changed, 25 insertions, 10 deletions
diff --git a/org.aspectj.matcher/src/org/aspectj/weaver/patterns/PatternParser.java b/org.aspectj.matcher/src/org/aspectj/weaver/patterns/PatternParser.java index 7bb8593a4..320fe2121 100644 --- a/org.aspectj.matcher/src/org/aspectj/weaver/patterns/PatternParser.java +++ b/org.aspectj.matcher/src/org/aspectj/weaver/patterns/PatternParser.java @@ -202,19 +202,34 @@ public class PatternParser { } public ISignaturePattern parseCompoundFieldSignaturePattern() { - ISignaturePattern atomicFieldSignaturePattern = parseMaybeParenthesizedFieldSignaturePattern(); + int index = tokenSource.getIndex(); + try { + ISignaturePattern atomicFieldSignaturePattern = parseMaybeParenthesizedFieldSignaturePattern(); - while (isEitherAndOrOr()) { - if (maybeEat("&&")) { - atomicFieldSignaturePattern = new AndSignaturePattern(atomicFieldSignaturePattern, - parseMaybeParenthesizedFieldSignaturePattern()); + while (isEitherAndOrOr()) { + if (maybeEat("&&")) { + atomicFieldSignaturePattern = new AndSignaturePattern(atomicFieldSignaturePattern, + parseMaybeParenthesizedFieldSignaturePattern()); + } + if (maybeEat("||")) { + atomicFieldSignaturePattern = new OrSignaturePattern(atomicFieldSignaturePattern, + parseMaybeParenthesizedFieldSignaturePattern()); + } } - if (maybeEat("||")) { - atomicFieldSignaturePattern = new OrSignaturePattern(atomicFieldSignaturePattern, - parseMaybeParenthesizedFieldSignaturePattern()); + return atomicFieldSignaturePattern; + } catch (ParserException e) { + // fallback in the case of a regular single field signature pattern that just happened to start with '(' + int nowAt = tokenSource.getIndex(); + tokenSource.setIndex(index); + try { + ISignaturePattern fsp = parseFieldSignaturePattern(); + return fsp; + } catch (Exception e2) { + tokenSource.setIndex(nowAt); + // throw the original + throw e; } } - return atomicFieldSignaturePattern; } private boolean isEitherAndOrOr() { @@ -781,7 +796,7 @@ public class PatternParser { return p; } int startPos = tokenSource.peek().getStart(); - if (ap.start!=-1) { + if (ap.start != -1) { startPos = ap.start; } TypePattern p = parseSingleTypePattern(insideTypeParameters); |