package tool.editors.text;
import java.util.ArrayList;
import org.eclipse.jface.text.rules.IPredicateRule;
import org.eclipse.jface.text.rules.IToken;
import org.eclipse.jface.text.rules.MultiLineRule;
import org.eclipse.jface.text.rules.RuleBasedPartitionScanner;
import org.eclipse.jface.text.rules.Token;
import tool.editors.rules.DoubleHyphenCommentRule;
import tool.editors.rules.DoubleSlashCommentRule;
import tool.editors.rules.MultiLineCommentRule;
import tool.editors.rules.MultiLineWordPatternRule;
public class ToolPartitionScanner extends RuleBasedPartitionScanner {
public final static String TOOL_COMMENT = "__tool_comment";
public final static String TOOL_SQL= "__tool_sql";
public ToolPartitionScanner() {
IToken toolComment = new Token(TOOL_COMMENT);
IToken toolSQL = new Token(TOOL_SQL);
ArrayList<IPredicateRule> rules = new ArrayList<IPredicateRule>();
rules.add(new MultiLineCommentRule(toolComment));
rules.add(new DoubleHyphenCommentRule(toolComment));
rules.add(new DoubleSlashCommentRule(toolComment));
rules.add(new MultiLineRule("SQL", ";", toolSQL));
rules.add(new MultiLineRule("sql", ";", toolSQL));
//rules.add(new MultiLineRule("SQL ", "do", toolSQL));
//rules.add(new MultiLineRule("sql ", "do", toolSQL));
IPredicateRule[] rulesArray = new IPredicateRule[rules.size()];
rules.toArray(rulesArray);
setPredicateRules(rulesArray);
}
}