01: /*
02: * All content copyright (c) 2003-2006 Terracotta, Inc., except as may otherwise be noted in a separate copyright notice. All rights reserved.
03: */
04: package org.terracotta.dso.editors.xml;
05:
06: import org.eclipse.jface.text.TextAttribute;
07: import org.eclipse.jface.text.rules.IRule;
08: import org.eclipse.jface.text.rules.IToken;
09: import org.eclipse.jface.text.rules.RuleBasedScanner;
10: import org.eclipse.jface.text.rules.SingleLineRule;
11: import org.eclipse.jface.text.rules.Token;
12: import org.eclipse.jface.text.rules.WhitespaceRule;
13:
14: public class XMLScanner extends RuleBasedScanner {
15:
16: public XMLScanner(ColorManager manager) {
17: IToken procInstr = new Token(new TextAttribute(manager
18: .getColor(IXMLColorConstants.PROC_INSTR)));
19:
20: IRule[] rules = new IRule[2];
21: //Add rule for processing instructions
22: rules[0] = new SingleLineRule("<?", "?>", procInstr);
23: // Add generic whitespace rule.
24: rules[1] = new WhitespaceRule(new XMLWhitespaceDetector());
25:
26: setRules(rules);
27: }
28: }
|