61e7a31d5bc421dca49d3a745aefaec44030f0b7
[phpeclipse.git] / net.sourceforge.phpeclipse / src / net / sourceforge / phpeclipse / editors / PHPPartitionScanner.java
1
2 package net.sourceforge.phpeclipse.editors;
3
4 import java.util.ArrayList;
5 import java.util.List;
6
7 import org.eclipse.jface.text.IDocument;
8 import org.eclipse.jface.text.rules.*;
9
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";
15
16         public PHPPartitionScanner() {
17
18                 List rules = new ArrayList();
19
20                 IToken php_tag      = new Token(HTML_TAG);
21                 IToken php_comment  = new Token(PHP_COMMENT);
22                 IToken html_comment = new Token(HTML_COMMENT);
23
24                 rules.add(new MultiLineRule("<!--", "-->", html_comment));
25                 rules.add(new MultiLineRule("/*", "*/", php_comment));
26                 rules.add(new MultiLineRule("<script", "script>", php_tag));
27                 
28 //              rules.add(new TagRule(tag));
29
30                 IPredicateRule[] result= new IPredicateRule[rules.size()];
31                 rules.toArray(result);
32                 setPredicateRules(result);
33         }
34 }