e39eff8f5c14728ec3479ce210459e1eef5c5e6e
[phpeclipse.git] / net.sourceforge.phpeclipse / src / net / sourceforge / phpeclipse / editors / PHPTagScanner.java
1 package net.sourceforge.phpeclipse.editors;
2
3 import org.eclipse.jface.text.*;
4 import java.util.*;
5 import org.eclipse.jface.text.rules.*;
6
7 public class PHPTagScanner extends RuleBasedScanner {
8
9         public PHPTagScanner(ColorManager manager) {
10                 IToken string =
11                         new Token(
12                                 new TextAttribute(manager.getColor(IPHPColorConstants.STRING)));
13
14                 Vector rules = new Vector();
15
16                 // Add rule for single and double quotes
17                 rules.add(new SingleLineRule("\"", "\"", string, '\\'));
18                 rules.add(new SingleLineRule("'", "'", string, '\\'));
19
20                 // Add generic whitespace rule.
21                 rules.add(new WhitespaceRule(new WhitespaceDetector()));
22
23                 IRule[] result = new IRule[rules.size()];
24                 rules.copyInto(result);
25                 setRules(result);
26         }
27         public IToken nextToken() {
28                 return super.nextToken();
29         }
30 }