1 15 16 package org.eclipse.ant.internal.ui.editor.text; 17 18 24 25 import org.eclipse.jface.text.rules.IPredicateRule; 26 import org.eclipse.jface.text.rules.IToken; 27 import org.eclipse.jface.text.rules.MultiLineRule; 28 import org.eclipse.jface.text.rules.RuleBasedPartitionScanner; 29 import org.eclipse.jface.text.rules.Token; 30 31 41 public class AntEditorPartitionScanner extends RuleBasedPartitionScanner { 42 43 public final static String XML_COMMENT = "__xml_comment"; public final static String XML_TAG = "__xml_tag"; public final static String XML_CDATA = "__xml_cdata"; public final static String XML_DTD = "__xml_dtd"; 48 51 public AntEditorPartitionScanner() { 52 53 IPredicateRule[] rules =new IPredicateRule[4]; 54 55 IToken xmlCDATA = new Token(XML_CDATA); 56 rules[0]= new MultiLineRule("<![CDATA[", "]]>", xmlCDATA); 58 IToken xmlComment = new Token(XML_COMMENT); 59 rules[1]= new MultiLineRule("<!--", "-->", xmlComment, '\\', true); 61 IToken tag = new Token(XML_TAG); 62 rules[2]= new TagRule(tag); 63 64 IToken xmlDTD = new Token(XML_DTD); 65 rules[3]= new DocTypeRule(xmlDTD); 66 67 setPredicateRules(rules); 68 } 69 } | Popular Tags |