2 package net.sourceforge.phpeclipse.editors;
4 import java.util.ArrayList;
7 import org.eclipse.jface.text.IDocument;
8 import org.eclipse.jface.text.rules.*;
10 public class PHPPartitionScanner extends RuleBasedPartitionScanner {
11 public final static String HTML_COMMENT = "__html_comment";
12 public final static String HTML_TAG = "__tag";
13 public final static String PHP_COMMENT = "__php_comment";
14 public final static String PHP_STRING = "__php_string";
16 public PHPPartitionScanner() {
18 List rules = new ArrayList();
20 IToken php_tag = new Token(HTML_TAG);
21 IToken php_comment = new Token(PHP_COMMENT);
22 IToken html_comment = new Token(HTML_COMMENT);
24 rules.add(new MultiLineRule("<!--", "-->", html_comment));
25 rules.add(new MultiLineRule("/*", "*/", php_comment));
26 rules.add(new MultiLineRule("<script", "script>", php_tag));
28 // rules.add(new TagRule(tag));
30 IPredicateRule[] result= new IPredicateRule[rules.size()];
31 rules.toArray(result);
32 setPredicateRules(result);