Rule not working. [message #710637] |
Fri, 05 August 2011 04:44  |
Eclipse User |
|
|
|
Hi, everyone!
I have question about Editor plugin. I created my rule such as WordRule.
I have this code in evaluatein method:
public IToken evaluate(ICharacterScanner scanner) {
int c = 0;
if (scanner.getColumn() > 0) {
scanner.unread();
c = scanner.read();
if (!Character.isWhitespace((char) c)) {
return fDefaultToken;
}
}
c= scanner.read();
if (c != ICharacterScanner.EOF && fDetector.isWordStart((char) c)) {
if (fColumn == UNDEFINED || (fColumn == scanner.getColumn() - 1)) {
fBuffer.setLength(0);
do {
if (!fDetector.isWordPart((char) c))
break;
fBuffer.append((char) c);
c= scanner.read();
} while (c != ICharacterScanner.EOF);
String buffer= fBuffer.toString().toLowerCase().trim();
IToken token= (IToken)fWords.get(buffer);
if (token != null) {
return token;
}
if (fDefaultToken.isUndefined())
unreadBuffer(scanner);
return fDefaultToken;
}
}
1. When I started existing file, all working correct.
2. When I add whitespace between letter in word or before (after), all working correct.
3. When I add new letter before (after) to keyword part of old text has color such as predefined and new part of word has color such as undefined text. I debug my code and I see that this method return Token.Undefined.
What Do I do incorrect. Thanks for help!
|
|
|
|
Powered by
FUDForum. Page generated in 0.08595 seconds