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