7a53f1c6ffb822c3eb26bbb543eb74fa59c438f3
[phpeclipse.git] / net.sourceforge.phpeclipse / src / net / sourceforge / phpeclipse / editors / TagRule.java
1 package net.sourceforge.phpeclipse.editors;
2
3 import org.eclipse.jface.text.rules.*;
4
5 public class TagRule extends MultiLineRule {
6
7         public TagRule(IToken token) {
8                 super("<", ">", token);
9         }
10         protected boolean sequenceDetected(
11                 ICharacterScanner scanner,
12                 char[] sequence,
13                 boolean eofAllowed) {
14                 int c = scanner.read();
15                 if (sequence[0] == '<') {
16                         if (c == '?') {
17                                 // processing instruction - abort
18                                 scanner.unread();
19                                 return false;
20                         }
21                         if (c == '!') {
22                                 scanner.unread();
23                                 // comment - abort
24                                 return false;
25                         }
26                 } else if (sequence[0] == '>') {
27                         scanner.unread();
28                 }
29                 return super.sequenceDetected(scanner, sequence, eofAllowed);
30         }
31 }