// Path: src/main/java/org/antlr/jetbrains/st4plugin/psi/STGroupTokenTypes.java
// public class STGroupTokenTypes {
// 
//     private static final List<TokenIElementType> TOKEN_ELEMENT_TYPES = PSIElementTypeFactory.getTokenIElementTypes(STGroupLanguage.INSTANCE);
//     private static final List<RuleIElementType> RULE_ELEMENT_TYPES = PSIElementTypeFactory.getRuleIElementTypes(STGroupLanguage.INSTANCE);
// 
//     public static RuleIElementType getRuleElementType(@MagicConstant(valuesFromClass = STGParser.class) int ruleIndex) {
//         return RULE_ELEMENT_TYPES.get(ruleIndex);
//     }
// 
//     public static TokenIElementType getTokenElementType(@MagicConstant(valuesFromClass = STGLexer.class) int ruleIndex) {
//         return TOKEN_ELEMENT_TYPES.get(ruleIndex);
//     }
// }
// 
// Path: src/main/java/org/antlr/jetbrains/st4plugin/psi/STGroupTokenTypes.java
// public static RuleIElementType getRuleElementType(@MagicConstant(valuesFromClass = STGParser.class) int ruleIndex) {
//     return RULE_ELEMENT_TYPES.get(ruleIndex);
// }


import com.intellij.lang.annotation.AnnotationHolder;
import com.intellij.lang.annotation.Annotator;
import com.intellij.openapi.editor.DefaultLanguageHighlighterColors;
import com.intellij.openapi.editor.colors.TextAttributesKey;
import com.intellij.psi.PsiElement;
import org.antlr.jetbrains.st4plugin.parsing.STGLexer;
import org.antlr.jetbrains.st4plugin.parsing.STGParser;
import org.antlr.jetbrains.st4plugin.psi.STGroupTokenTypes;
import org.jetbrains.annotations.NotNull;
import static com.intellij.openapi.editor.colors.TextAttributesKey.createTextAttributesKey;
import static org.antlr.jetbrains.st4plugin.psi.STGroupTokenTypes.getRuleElementType;
package org.antlr.jetbrains.st4plugin.highlight;



/**
 * Highlights a group's formal args differently from its name.
 */
public class STGroupSemanticHighlightAnnotator implements Annotator {

    public static final TextAttributesKey TEMPLATE_PARAM = createTextAttributesKey("STGroup_TEMPLATE_PARAM", DefaultLanguageHighlighterColors.INSTANCE_FIELD);

    @Override
    public void annotate(@NotNull PsiElement element, @NotNull AnnotationHolder holder) {
        if (element.getNode().getElementType() == STGroupTokenTypes.getTokenElementType(STGLexer.ID)) {
// Path: src/main/java/org/antlr/jetbrains/st4plugin/psi/STGroupTokenTypes.java
// public class STGroupTokenTypes {
// 
//     private static final List<TokenIElementType> TOKEN_ELEMENT_TYPES = PSIElementTypeFactory.getTokenIElementTypes(STGroupLanguage.INSTANCE);
//     private static final List<RuleIElementType> RULE_ELEMENT_TYPES = PSIElementTypeFactory.getRuleIElementTypes(STGroupLanguage.INSTANCE);
// 
//     public static RuleIElementType getRuleElementType(@MagicConstant(valuesFromClass = STGParser.class) int ruleIndex) {
//         return RULE_ELEMENT_TYPES.get(ruleIndex);
//     }
// 
//     public static TokenIElementType getTokenElementType(@MagicConstant(valuesFromClass = STGLexer.class) int ruleIndex) {
//         return TOKEN_ELEMENT_TYPES.get(ruleIndex);
//     }
// }
// 
// Path: src/main/java/org/antlr/jetbrains/st4plugin/psi/STGroupTokenTypes.java
// public static RuleIElementType getRuleElementType(@MagicConstant(valuesFromClass = STGParser.class) int ruleIndex) {
//     return RULE_ELEMENT_TYPES.get(ruleIndex);
// }


// Path: src/main/java/org/antlr/jetbrains/st4plugin/highlight/STGroupSemanticHighlightAnnotator.java
import com.intellij.lang.annotation.AnnotationHolder;
import com.intellij.lang.annotation.Annotator;
import com.intellij.openapi.editor.DefaultLanguageHighlighterColors;
import com.intellij.openapi.editor.colors.TextAttributesKey;
import com.intellij.psi.PsiElement;
import org.antlr.jetbrains.st4plugin.parsing.STGLexer;
import org.antlr.jetbrains.st4plugin.parsing.STGParser;
import org.antlr.jetbrains.st4plugin.psi.STGroupTokenTypes;
import org.jetbrains.annotations.NotNull;
import static com.intellij.openapi.editor.colors.TextAttributesKey.createTextAttributesKey;
import static org.antlr.jetbrains.st4plugin.psi.STGroupTokenTypes.getRuleElementType;

package org.antlr.jetbrains.st4plugin.highlight;



/**
 * Highlights a group's formal args differently from its name.
 */
public class STGroupSemanticHighlightAnnotator implements Annotator {

    public static final TextAttributesKey TEMPLATE_PARAM = createTextAttributesKey("STGroup_TEMPLATE_PARAM", DefaultLanguageHighlighterColors.INSTANCE_FIELD);

    @Override
    public void annotate(@NotNull PsiElement element, @NotNull AnnotationHolder holder) {
        if (element.getNode().getElementType() == STGroupTokenTypes.getTokenElementType(STGLexer.ID)) {
            if (element.getParent().getNode().getElementType() == getRuleElementType(STGParser.RULE_formalArg)) {