X-Git-Url: http://git.phpeclipse.com diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/editors/PHPPartitionScanner.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/editors/PHPPartitionScanner.java new file mode 100644 index 0000000..5c56abf --- /dev/null +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/editors/PHPPartitionScanner.java @@ -0,0 +1,33 @@ +package net.sourceforge.phpeclipse.editors; + +import java.util.ArrayList; +import java.util.List; + +import org.eclipse.jface.text.IDocument; +import org.eclipse.jface.text.rules.*; + +public class PHPPartitionScanner extends RuleBasedPartitionScanner { + public final static String HTML_COMMENT = "__html_comment"; + public final static String HTML_TAG = "__tag"; + public final static String PHP_COMMENT = "__php_comment"; + public final static String PHP_STRING = "__php_string"; + + public PHPPartitionScanner() { + + List rules = new ArrayList(); + + IToken php_tag = new Token(HTML_TAG); + IToken php_comment = new Token(PHP_COMMENT); + IToken html_comment = new Token(HTML_COMMENT); + + rules.add(new MultiLineRule("", html_comment)); + rules.add(new MultiLineRule("/*", "*/", php_comment)); + rules.add(new MultiLineRule("", php_tag)); + + // rules.add(new TagRule(tag)); + + IPredicateRule[] result = new IPredicateRule[rules.size()]; + rules.toArray(result); + setPredicateRules(result); + } +}