/* * Created on May 14, 2003 * * To change the template for this generated file go to * Window>Preferences>Java>Code Generation>Code and Comments */ package CDBuilder.couplingSyntaxEditor;import org.eclipse.jface.text.rules.EndOfLineRule; import org.eclipse.jface.text.rules.IPredicateRule; import org.eclipse.jface.text.rules.IToken; import org.eclipse.jface.text.rules.RuleBasedPartitionScanner; import org.eclipse.jface.text.rules.SingleLineRule; import org.eclipse.jface.text.rules.Token; /** * @author Lucie Zhao and Sherwin Sim * * @version 1 May - August 2003 * * This class sets up the partition scanner to detect * comments and default text */ public class csePartitionScanner extends RuleBasedPartitionScanner { /** label for default text */ public final static String CD_DEFAULT = "__cd_default"; /** label for comments */ public final static String CD_COMMENT = "__cd_comment"; /** *Initializes the tokens and sets up the rules for comments *and default text * */ public csePartitionScanner() { IToken cdComment = new Token(CD_COMMENT); IToken cdDefault = new Token(CD_DEFAULT); IPredicateRule[] rules = new IPredicateRule[3]; rules[0] = new EndOfLineRule("%", cdComment); // Add rule for strings and character constants. rules[1]= (new SingleLineRule("\"", "\"", cdDefault, '\\')); rules[2]= (new SingleLineRule("'", "'", cdDefault, '\\')); setPredicateRules(rules); } }