]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/editor2/SCLPartitionScanner.java
LabelDecorator.decorateLabel can return null
[simantics/platform.git] / bundles / org.simantics.scl.ui / src / org / simantics / scl / ui / editor2 / SCLPartitionScanner.java
1 package org.simantics.scl.ui.editor2;
2
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;
10
11 public class SCLPartitionScanner extends RuleBasedPartitionScanner {
12     public static final String SCL_COMMENT = "COMMENT";
13     public static final String SCL_STRING = "STRING";
14     
15     public static final IToken COMMENT_TOKEN = new Token(SCL_COMMENT);
16     public static final IToken STRING_TOKEN = new Token(SCL_STRING);
17     
18     public static final String[] PARTITION_TYPES = new String[] {
19             SCL_COMMENT,
20             SCL_STRING
21     };
22     
23     public SCLPartitionScanner() {
24         super();
25
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),
31         });
32     }
33 }