Commit 2b763eff authored by Miklos Magyari's avatar Miklos Magyari
Browse files

Temporarily disabled semantic highlighting rules for code peek


Signed-off-by: Miklos Magyari's avatarMiklos Magyari <miklos.magyari@sigmatechnology.se>
parent 37a32806
......@@ -124,7 +124,7 @@ public class PeekSource {
}
IDocument doc = new Document(source);
CodeScanner scanner = new CodeScanner(new ColorManager());
CodeScanner scanner = new CodeScanner(new ColorManager(), true);
scanner.setRange(doc, 0, source.length());
IToken token;
StringBuilder codestr = new StringBuilder("<pre>");
......
......@@ -109,7 +109,11 @@ public final class CodeScanner extends RuleBasedScanner implements IDocumentGett
public static final String[] VISIBILITY_MODIFIERS = new String[] { "public", "private", "friend" };
public CodeScanner(final ColorManager colorManager) {
final List<IRule> rules = getTTCNRules(colorManager);
this(colorManager, false);
}
public CodeScanner(final ColorManager colorManager, boolean skipSemanticHighlightingRule) {
final List<IRule> rules = getTTCNRules(colorManager, skipSemanticHighlightingRule);
// line marker (single line preprocessor directive)
final IToken preprocessor = colorManager.createTokenFromPreference(PreferenceConstants.COLOR_PREPROCESSOR);
......@@ -118,6 +122,10 @@ public final class CodeScanner extends RuleBasedScanner implements IDocumentGett
}
public static List<IRule> getTTCNRules(final ColorManager colorManager) {
return getTTCNRules(colorManager, false);
}
public static List<IRule> getTTCNRules(final ColorManager colorManager, boolean skipSemanticHighlightingRule) {
final IToken keyword = colorManager.createTokenFromPreference(PreferenceConstants.COLOR_TTCN3_KEYWORDS);
final IToken templateMatch = colorManager.createTokenFromPreference(PreferenceConstants.COLOR_TEMPLATE_MATCH);
final IToken types = colorManager.createTokenFromPreference(PreferenceConstants.COLOR_TYPE);
......@@ -145,7 +153,8 @@ public final class CodeScanner extends RuleBasedScanner implements IDocumentGett
rules.add(new StringDetectionPatternRule("'", new char[][] { { '\'', 'B' }, { '\'', 'H' }, { '\'', 'O' } }, string));
rules.add(new NumberDetectionPatternRule(ninteger, nfloat));
final WordRule wordRule = new AstWordRule(new WordDetector(), other);
final WordRule wordRule = skipSemanticHighlightingRule ?
new WordRule(new WordDetector(), other) : new AstWordRule(new WordDetector(), other);
for (final String element : CodeScanner.KEYWORDS) {
wordRule.addWord(element, keyword);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment