add(rule, type, factory, rules);
}
}
public static void add(final Rule rule, final Type type, ITokenFactory factory, final List rules) {
final IToken token = factory.makeToken(type);
final Mode mode = rule.getMode();
final boolean ignoreCase = rule.getIgnoreCase();
type.accept(new IVisitor() {
public void acceptSpan(Span span) {
IToken defaultToken = token;
if(span.hasDelegate()) {
Rule delegateRule = mode.getRule(span.getDelegate());
defaultToken = new DelegateToken(type, delegateRule, span.getEnd());
}
/* Using a PatternRule instead of a MultiLineRule because
* PatternRule exposes the break on newline behavior. */
PatternRule pat = new CasedPatternRule(span.getStart(), span.getEnd(),
defaultToken, mode.getDefaultRuleSet().getEscape(), span.noLineBreak(),
ignoreCase);
rules.add(pat);
}
public void acceptTextSequence(TextSequence text) {
/* If the text sequence can be recognized as a word, don't