package edu.kit.iti.formal.pse.worthwhile.ui.editor;

import org.eclipse.xtext.ui.editor.syntaxcoloring.DefaultAntlrTokenToAttributeIdMapper;

/**
 * Maps tokens to attribute IDs, thus providing services such as highlighting.
 * 
 * @author Joachim
 * 
 */
public class WorthwhileTokenToAttributeIdMapper extends DefaultAntlrTokenToAttributeIdMapper {

	@Override
	protected final String calculateId(final String tokenName, final int tokenType) {
		if ("RULE_BOOL".equals(tokenName)) {
			// Provide our own ID for Boolean literals
			return WorthwhileHighlightingConfiguration.BOOL_ID;
		} else if ("RULE_NUMBER".equals(tokenName)) {
			// Map our own Integer type to the default Number ID.
			return WorthwhileHighlightingConfiguration.NUMBER_ID;
		}

		return super.calculateId(tokenName, tokenType);
	}

}

@@ -47,16 +47,42 @@
 ditor;%0A%0A
+import java.util.Arrays;%0A%0A
 import o
@@ -466,16 +466,197 @@
 Type) %7B%0A
+%09%09// Tokens that should be deemed punctuation characters and not be highlighted%0A%09%09String%5B%5D additionalPunctuationTokens = %7B %22%C2%AC%22, %22%E2%88%99%22, %22%C3%B7%22, %22%E2%8B%85%22, %22%E2%89%A4%22, %22%E2%89%A5%22, %22%E2%89%A0%22, %22%E2%88%A7%22, %22%E2%87%92%22, %22%E2%88%A8%22, %22%E2%87%94%22 %7D;%0A%0A
 %09%09if (%22R
@@ -952,17 +952,439 @@
 _ID;%0A%09%09%7D
-%0A
+ else if (tokenName.length() %3E= 3 // filter out the quotes arount the token name%0A%09%09                && Arrays.asList(additionalPunctuationTokens).contains(%0A%09%09                                tokenName.substring(1, tokenName.length() - 1))) %7B%0A%09%09%09// Map punctuation characters to the default punctuation ID.%0A%09%09%09return WorthwhileHighlightingConfiguration.PUNCTUATION_ID;%0A%09%09%7D%0A%0A%09%09System.out.println(tokenName + %22 - %22 + tokenType);
 %0A%09%09retur

Fix #31: Disable syntax highlighting for Unicode operator symbols