diff options
author | aclement <aclement> | 2004-07-29 12:39:42 +0000 |
---|---|---|
committer | aclement <aclement> | 2004-07-29 12:39:42 +0000 |
commit | 45bce91f642a86ca3db7238d9e4cfb81d85e4f5b (patch) | |
tree | 9b4d06e48ff89d0771ed4f13007a70f4ca81dc6a /weaver | |
parent | 770a4d6a1474764dd24e292e0404c04c44f33d90 (diff) | |
download | aspectj-45bce91f642a86ca3db7238d9e4cfb81d85e4f5b.tar.gz aspectj-45bce91f642a86ca3db7238d9e4cfb81d85e4f5b.zip |
Fix for Bugzilla Bug 61536
Front-end bug, shouldn't allow patterns of the form foo.., should be foo..*
Diffstat (limited to 'weaver')
-rw-r--r-- | weaver/src/org/aspectj/weaver/patterns/PatternParser.java | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/weaver/src/org/aspectj/weaver/patterns/PatternParser.java b/weaver/src/org/aspectj/weaver/patterns/PatternParser.java index 0f0bd3e57..89a168fef 100644 --- a/weaver/src/org/aspectj/weaver/patterns/PatternParser.java +++ b/weaver/src/org/aspectj/weaver/patterns/PatternParser.java @@ -448,12 +448,17 @@ public class PatternParser { List names = new ArrayList(); StringBuffer buf = new StringBuffer(); IToken previous = null; + boolean justProcessedEllipsis = false; // Remember if we just dealt with an ellipsis (PR61536) + boolean justProcessedDot = false; + boolean onADot = false; while (true) { - IToken tok; + IToken tok = null; int startPos = tokenSource.peek().getStart(); String afterDot = null; while (true) { + if (previous !=null && previous.getString().equals(".")) justProcessedDot = true; tok = tokenSource.peek(); + onADot = (tok.getString().equals(".")); if (previous != null) { if (!isAdjacent(previous, tok)) break; } @@ -481,13 +486,22 @@ public class PatternParser { throw new ParserException("expected name pattern", tok); } + if (buf.length() == 0 && justProcessedEllipsis) { + throw new ParserException("name pattern cannot finish with ..", tok); + } + if (buf.length() == 0 && justProcessedDot && !onADot) { + throw new ParserException("name pattern cannot finish with .", tok); + } + if (buf.length() == 0) { names.add(NamePattern.ELLIPSIS); + justProcessedEllipsis = true; } else { checkLegalName(buf.toString(), previous); NamePattern ret = new NamePattern(buf.toString()); ret.setLocation(sourceContext, startPos, endPos); names.add(ret); + justProcessedEllipsis = false; } if (afterDot == null) { |