1 package org.simantics.scl.ui.editor2;
3 import org.eclipse.jface.text.rules.EndOfLineRule;
4 import org.eclipse.jface.text.rules.IPredicateRule;
5 import org.eclipse.jface.text.rules.IToken;
6 import org.eclipse.jface.text.rules.MultiLineRule;
7 import org.eclipse.jface.text.rules.RuleBasedPartitionScanner;
8 import org.eclipse.jface.text.rules.SingleLineRule;
9 import org.eclipse.jface.text.rules.Token;
11 public class SCLPartitionScanner extends RuleBasedPartitionScanner {
12 public static final String SCL_COMMENT = "COMMENT";
13 public static final String SCL_STRING = "STRING";
15 public static final IToken COMMENT_TOKEN = new Token(SCL_COMMENT);
16 public static final IToken STRING_TOKEN = new Token(SCL_STRING);
18 public static final String[] PARTITION_TYPES = new String[] {
23 public SCLPartitionScanner() {
26 setPredicateRules(new IPredicateRule[] {
27 new EndOfLineRule("//", COMMENT_TOKEN),
28 new MultiLineRule("\"\"\"", "\"\"\"", STRING_TOKEN, (char) 0, true),
29 new SingleLineRule("\"", "\"", STRING_TOKEN, '\\'),
30 new MultiLineRule("/*", "*/", COMMENT_TOKEN, (char) 0, true),