1 package net.sourceforge.phpeclipse.editors;
3 import java.util.ArrayList;
6 import org.eclipse.jface.text.IDocument;
7 import org.eclipse.jface.text.rules.*;
9 public class PHPPartitionScanner extends RuleBasedPartitionScanner {
10 public final static String HTML_COMMENT = "__html_comment";
11 public final static String HTML_TAG = "__tag";
12 public final static String PHP_COMMENT = "__php_comment";
13 public final static String PHP_STRING = "__php_string";
15 public PHPPartitionScanner() {
17 List rules = new ArrayList();
19 IToken php_tag = new Token(HTML_TAG);
20 IToken php_comment = new Token(PHP_COMMENT);
21 IToken html_comment = new Token(HTML_COMMENT);
23 rules.add(new MultiLineRule("<!--", "-->", html_comment));
24 rules.add(new MultiLineRule("/*", "*/", php_comment));
25 rules.add(new MultiLineRule("<script", "script>", php_tag));
27 // rules.add(new TagRule(tag));
29 IPredicateRule[] result = new IPredicateRule[rules.size()];
30 rules.toArray(result);
31 setPredicateRules(result);