rules.add(new MultiLineRule("/*" , "*/" , comment));
rules.add(new EndOfLineRule("//", comment));
rules.add(new SingleLineRule("\"", "\"", string, '\\'));
rules.add(new SingleLineRule("\'", "\'", string, '\\'));
WordRule wordRule = new WordRule(new JavaWordDetector(), normal);
for(int i=0;i<KEYWORDS.length;i++){
wordRule.addWord(KEYWORDS[i], keyword);
}
rules.add(wordRule);
WordRule delimitor = new WordRule(new IWordDetector(){
public boolean isWordStart(char c){
if(c=='<' || c=='%'){
return true;
}
return false;
}
public boolean isWordPart(char c){
if(c=='<' || c=='%' || c=='=' || c=='>'){
return true;
}
return false;
}
}, normal);
delimitor.addWord("<%=", script);
delimitor.addWord("<%", script);
delimitor.addWord("%>", script);
rules.add(delimitor);
rules.add(new WhitespaceRule(new JavaWhitespaceDetector()));
setRules((IRule[])rules.toArray(new IRule[rules.size()]));
}