📄 ruleset.java
字号:
/*
* RuleSet.java - A set of rules used by the user-defined syntax highlighting
* system.
*/
package org.fife.ui.rsyntaxtextarea.custom;
import org.fife.ui.rsyntaxtextarea.TokenMap;
/**
* A set of rules used by the user-defined syntax highlighting system.
*
* @author Robert Futrell
* @version 0.1
*/
public class RuleSet {
private Rule[] rules;
private int ruleCount;
private TokenMap wordsToHighlight;
/*****************************************************************************/
public RuleSet(Rule[] rules, TokenMap wordsToHighlight) {
this.rules = rules;
ruleCount = rules.length;
this.wordsToHighlight = wordsToHighlight;
}
/*****************************************************************************/
public Rule getRule(int index) {
if (index<0 || index>=getRuleCount())
throw new IndexOutOfBoundsException("index must be " +
"between 0 and " + (getRuleCount()-1));
return rules[index];
}
/*****************************************************************************/
public int getRuleCount() {
return ruleCount;
}
/*****************************************************************************/
public int getTokenTypeForIdentifier(String identifier) {
int type = -1;
if (wordsToHighlight!=null) {
char[] array = identifier.toCharArray();
type = wordsToHighlight.get(array, 0,array.length-1);
}
return type;
}
/*****************************************************************************/
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -