01: /*******************************************************************************
02: * Copyright (c) 2000, 2005 IBM Corporation and others.
03: * All rights reserved. This program and the accompanying materials
04: * are made available under the terms of the Eclipse Public License v1.0
05: * which accompanies this distribution, and is available at
06: * http://www.eclipse.org/legal/epl-v10.html
07: *
08: * Contributors:
09: * IBM Corporation - initial API and implementation
10: *******************************************************************************/package org.eclipse.ui.examples.templateeditor.editors;
11:
12: import org.eclipse.jface.text.rules.*;
13:
14: public class TagRule extends MultiLineRule {
15:
16: public TagRule(IToken token) {
17: super ("<", ">", token); //$NON-NLS-1$//$NON-NLS-2$
18: }
19:
20: protected boolean sequenceDetected(ICharacterScanner scanner,
21: char[] sequence, boolean eofAllowed) {
22: int c = scanner.read();
23: if (sequence[0] == '<') {
24: if (c == '?') {
25: // processing instruction - abort
26: scanner.unread();
27: return false;
28: }
29: if (c == '!') {
30: scanner.unread();
31: // comment - abort
32: return false;
33: }
34: } else if (sequence[0] == '>') {
35: scanner.unread();
36: }
37: return super.sequenceDetected(scanner, sequence, eofAllowed);
38: }
39: }
|