2 * Copyright (c) 2002-2004 Widespace, OU and others.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Common Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/cpl-v10.html
9 * Igor Malinin - initial contribution
11 * $Id: TextScanner.java,v 1.3 2006-10-21 23:14:13 pombredanne Exp $
14 package net.sourceforge.phpeclipse.xml.ui.internal.text;
18 import net.sourceforge.phpeclipse.xml.ui.text.IXMLSyntaxConstants;
20 import org.eclipse.jface.text.rules.BufferedRuleBasedScanner;
21 import org.eclipse.jface.text.rules.IRule;
22 import org.eclipse.jface.text.rules.IToken;
23 import org.eclipse.jface.text.rules.Token;
26 * @author Igor Malinin
28 public class TextScanner extends BufferedRuleBasedScanner {
31 * Creates a color scanner for XML text or attribute value.
33 public TextScanner(Map tokens, char startEntity, String defaultProperty) {
34 setDefaultReturnToken((Token) tokens.get(defaultProperty));
36 IToken entity = (Token) tokens.get(IXMLSyntaxConstants.XML_ENTITY);
38 IRule[] rules = { new EntityRule(startEntity, entity) };