/*******************************************************************************
* Copyright (c) 2009, 2010 Innovation Gate GmbH.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Innovation Gate GmbH - initial API and implementation
******************************************************************************/
package de.innovationgate.eclipse.editors.tmlscript;
import java.util.ArrayList;
import java.util.List;
import org.eclipse.jface.text.rules.IPredicateRule;
import org.eclipse.jface.text.rules.RuleBasedPartitionScanner;
import org.eclipse.jface.text.rules.Token;
import de.innovationgate.eclipse.editors.helpers.WrappedRuleBasedPartionScanner;
public class TMLScriptPartitionScanner extends WrappedRuleBasedPartionScanner {
public static final String SCOMMENT = "__singleline_comment";
public static final String MCOMMENT = "__multiline_comment";
public static final String TMLSCRIPT = "__tmlscript";
public static final String[] PARTITIONS = {TMLSCRIPT, SCOMMENT, MCOMMENT};
private RuleBasedPartitionScanner _ruleScanner;
public TMLScriptPartitionScanner() {
List<IPredicateRule> rules = new ArrayList<IPredicateRule>();
rules.add(new TMLScriptMultiLineCommentRule());
rules.add(new TMLScriptSingelLineCommentRule());
_ruleScanner = new RuleBasedPartitionScanner();
_ruleScanner.setPredicateRules(rules.toArray(new IPredicateRule[0]));
setDefaultReturnToken(new Token(TMLSCRIPT));
}
@Override
public RuleBasedPartitionScanner getRuleScanner() {
return _ruleScanner;
}
}