/*******************************************************************************
* 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.tml;
import java.util.ArrayList;
import java.util.List;
import org.eclipse.jface.text.rules.IPredicateRule;
import org.eclipse.jface.text.rules.MultiLineRule;
import org.eclipse.jface.text.rules.RuleBasedPartitionScanner;
import org.eclipse.jface.text.rules.SingleLineRule;
import org.eclipse.jface.text.rules.Token;
public class TMLRuleBasedPartitionScanner extends RuleBasedPartitionScanner {
public TMLRuleBasedPartitionScanner() {
List<IPredicateRule> rules = new ArrayList<IPredicateRule>();
SingleLineRule mdHeaderRule = new SingleLineRule("##MD", null, new Token(TMLPartitionScanner.TML_METAHEADER), '\\', true);
mdHeaderRule.setColumnConstraint(0);
rules.add(mdHeaderRule);
rules.add(new MultiLineRule("<!--", "-->", new Token(TMLPartitionScanner.COMMENT), '\\', true));
rules.add(new MultiLineRule("<tml:comment>", "</tml:comment>", new Token(TMLPartitionScanner.TML_COMMENT), '\\', true));
rules.add(new MultiLineRule("<tml:disable>", "</tml:disable>", new Token(TMLPartitionScanner.TML_DISABLE), '\\', true));
rules.add(new TagRule("<tml:", ">", new Token(TMLPartitionScanner.TML_TAG_START), '\\', true));
//rules.add(new MultiLineRule("<tml:", ">", new Token(TMLPartitionScanner.TML_TAG_START), '\\', true));
rules.add(new SingleLineRule("</tml:", ">", new Token(TMLPartitionScanner.TML_TAG_STOP)));
setPredicateRules(rules.toArray(new IPredicateRule[0]));
}
}