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

import java.util.Arrays;

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) {
		// Tokens that should be deemed punctuation characters and not be highlighted
		String[] additionalPunctuationTokens = { "¬", "∙", "÷", "⋅", "≤", "≥", "≠", "∧", "⇒", "∨", "⇔" };

		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;
		} else if (tokenName.length() >= 3 // filter out the quotes arount the token name
		                && Arrays.asList(additionalPunctuationTokens).contains(
		                                tokenName.substring(1, tokenName.length() - 1))) {
			// Map punctuation characters to the default punctuation ID.
			return WorthwhileHighlightingConfiguration.PUNCTUATION_ID;
		}

		System.out.println(tokenName + " - " + tokenType);
		return super.calculateId(tokenName, tokenType);
	}

}

@@ -1327,61 +1327,8 @@
 %09%7D%0A%0A
-%09%09System.out.println(tokenName + %22 - %22 + tokenType);%0A
 %09%09re

Remove debug output in TokenToAttributeIdMapper