• Post Reply Bookmark Topic Watch Topic
  • New Topic

Syntax highlighting using WordRule  RSS feed

 
Chethan Sharma
Ranch Hand
Posts: 59
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Code:
=====
Color color = new Color(Display.getCurrent(), 0, 0, 0);
IToken plainCode =new Token(new TextAttribute(color));
WordRule keywordsRule = new WordRule(new IWordDetector(){


public boolean isWordStart(char c) {
return Character.isLetterOrDigit(c) || Character.isJavaIdentifierStart(c);
}
public boolean isWordPart(char c) {
return (c == '.') || Character.isLetterOrDigit(c) || Character.isJavaIdentifierPart(c);
}

},plainCode);

String keyword = "Test";
keywordsRule.addWord(keyword,plainCode );



I am not able to highlight "TEST","TEst","test".It highlights only"Test".
Pls let me know how to handle in all cases.

Thanks in Advance.
Rams
--------------------

Rams
 
Chethan Sharma
Ranch Hand
Posts: 59
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by RamaShankar Miryala:
Hi,

Code:
=====
Color color = new Color(Display.getCurrent(), 0, 0, 0);
IToken plainCode =new Token(new TextAttribute(color));
WordRule keywordsRule = new WordRule(new IWordDetector(){


public boolean isWordStart(char c) {
return Character.isLetterOrDigit(c) || Character.isJavaIdentifierStart(c);
}
public boolean isWordPart(char c) {
return (c == '.') || Character.isLetterOrDigit(c) || Character.isJavaIdentifierPart(c);
}

},plainCode);

String keyword = "Test";
keywordsRule.addWord(keyword,plainCode );



I am not able to highlight "TEST","TEst","test".It highlights only"Test".
Pls let me know how to handle in all cases.

Thanks in Advance.
Rams
--------------------

Rams



Please can some one reply to this.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!