Esempio n. 1
0
  public XMLScanner(ColorManager manager) {
    IToken procInstr =
        new Token(new TextAttribute(manager.getColor(IXMLColorConstants.PROC_INSTR)));

    IRule[] rules = new IRule[2];
    // Add rule for processing instructions
    rules[0] = new SingleLineRule("<?", "?>", procInstr);
    // Add generic whitespace rule.
    rules[1] = new WhitespaceRule(new XMLWhitespaceDetector());

    setRules(rules);
  }
  public XMLTagScanner(ColorManager manager) {
    IToken string = new Token(new TextAttribute(manager.getColor(IXMLColorConstants.STRING)));

    IRule[] rules = new IRule[3];

    // Add rule for double quotes
    rules[0] = new SingleLineRule("\"", "\"", string, '\\');
    // Add a rule for single quotes
    rules[1] = new SingleLineRule("'", "'", string, '\\');
    // Add generic whitespace rule.
    rules[2] = new WhitespaceRule(new XMLWhitespaceDetector());

    setRules(rules);
  }