// Path: src/org/emberjs/lang/lexer/EmberJSLexer.java
// public class EmberJSLexer extends MergingLexerAdapter {
//     public EmberJSLexer() {
//         // _EmberJSLexer is generated via ember.flex
//         super(new FlexAdapter(new _EmberJSLexer((Reader)null)), TokenSet.create(JSTokenTypes.STRING_LITERAL));
//     }
// }
// 
// Path: src/org/emberjs/lang/lexer/EmberJSTokenTypes.java
// public interface EmberJSTokenTypes extends JSTokenTypes {
//     EmberJSTokenType ESCAPE_SEQUENCE = new EmberJSTokenType("ESCAPE_SEQUENCE");
//     EmberJSTokenType INVALID_ESCAPE_SEQUENCE = new EmberJSTokenType("INVALID_ESCAPE_SEQUENCE");
//     EmberJSTokenType TRACK_BY_KEYWORD = new EmberJSTokenType("TRACK_BY_KEYWORD");
//     EmberJSTokenType ONE_TIME_BINDING = new EmberJSTokenType("ONE_TIME_BINDING");
// }


import com.intellij.lang.javascript.JSTokenTypes;
import com.intellij.lang.javascript.highlighting.JSHighlighter;
import com.intellij.lexer.Lexer;
import com.intellij.openapi.editor.DefaultLanguageHighlighterColors;
import com.intellij.openapi.editor.colors.TextAttributesKey;
import com.intellij.openapi.fileTypes.SingleLazyInstanceSyntaxHighlighterFactory;
import com.intellij.openapi.fileTypes.SyntaxHighlighter;
import com.intellij.psi.tree.IElementType;
import gnu.trove.THashMap;
import org.emberjs.lang.lexer.EmberJSLexer;
import org.emberjs.lang.lexer.EmberJSTokenTypes;
import org.jetbrains.annotations.NotNull;
import java.util.Map;
package org.emberjs.lang;



/**
 * @author Dennis.Ushakov
 */
public class EmberJSSyntaxHighlighterFactory extends SingleLazyInstanceSyntaxHighlighterFactory {
    @NotNull
    protected SyntaxHighlighter createHighlighter() {
        return new AngularJSSyntaxHighlighter();
    }

    private static class AngularJSSyntaxHighlighter extends JSHighlighter {
        private final Map<IElementType, TextAttributesKey> myKeysMap = new THashMap<IElementType, TextAttributesKey>();

        public AngularJSSyntaxHighlighter() {
            super(EmberJSLanguage.INSTANCE.getOptionHolder());
            myKeysMap.put(JSTokenTypes.AS_KEYWORD, DefaultLanguageHighlighterColors.KEYWORD);
            myKeysMap.put(EmberJSTokenTypes.TRACK_BY_KEYWORD, DefaultLanguageHighlighterColors.KEYWORD);
        }

        @NotNull
        public TextAttributesKey[] getTokenHighlights(final IElementType tokenType) {
            if (myKeysMap.containsKey(tokenType)) {
                return pack(myKeysMap.get(tokenType));
            }
            return super.getTokenHighlights(tokenType);
        }

        @NotNull
        @Override
        public Lexer getHighlightingLexer() {
// Path: src/org/emberjs/lang/lexer/EmberJSLexer.java
// public class EmberJSLexer extends MergingLexerAdapter {
//     public EmberJSLexer() {
//         // _EmberJSLexer is generated via ember.flex
//         super(new FlexAdapter(new _EmberJSLexer((Reader)null)), TokenSet.create(JSTokenTypes.STRING_LITERAL));
//     }
// }
// 
// Path: src/org/emberjs/lang/lexer/EmberJSTokenTypes.java
// public interface EmberJSTokenTypes extends JSTokenTypes {
//     EmberJSTokenType ESCAPE_SEQUENCE = new EmberJSTokenType("ESCAPE_SEQUENCE");
//     EmberJSTokenType INVALID_ESCAPE_SEQUENCE = new EmberJSTokenType("INVALID_ESCAPE_SEQUENCE");
//     EmberJSTokenType TRACK_BY_KEYWORD = new EmberJSTokenType("TRACK_BY_KEYWORD");
//     EmberJSTokenType ONE_TIME_BINDING = new EmberJSTokenType("ONE_TIME_BINDING");
// }


// Path: src/org/emberjs/lang/EmberJSSyntaxHighlighterFactory.java
import com.intellij.lang.javascript.JSTokenTypes;
import com.intellij.lang.javascript.highlighting.JSHighlighter;
import com.intellij.lexer.Lexer;
import com.intellij.openapi.editor.DefaultLanguageHighlighterColors;
import com.intellij.openapi.editor.colors.TextAttributesKey;
import com.intellij.openapi.fileTypes.SingleLazyInstanceSyntaxHighlighterFactory;
import com.intellij.openapi.fileTypes.SyntaxHighlighter;
import com.intellij.psi.tree.IElementType;
import gnu.trove.THashMap;
import org.emberjs.lang.lexer.EmberJSLexer;
import org.emberjs.lang.lexer.EmberJSTokenTypes;
import org.jetbrains.annotations.NotNull;
import java.util.Map;

package org.emberjs.lang;



/**
 * @author Dennis.Ushakov
 */
public class EmberJSSyntaxHighlighterFactory extends SingleLazyInstanceSyntaxHighlighterFactory {
    @NotNull
    protected SyntaxHighlighter createHighlighter() {
        return new AngularJSSyntaxHighlighter();
    }

    private static class AngularJSSyntaxHighlighter extends JSHighlighter {
        private final Map<IElementType, TextAttributesKey> myKeysMap = new THashMap<IElementType, TextAttributesKey>();

        public AngularJSSyntaxHighlighter() {
            super(EmberJSLanguage.INSTANCE.getOptionHolder());
            myKeysMap.put(JSTokenTypes.AS_KEYWORD, DefaultLanguageHighlighterColors.KEYWORD);
            myKeysMap.put(EmberJSTokenTypes.TRACK_BY_KEYWORD, DefaultLanguageHighlighterColors.KEYWORD);
        }

        @NotNull
        public TextAttributesKey[] getTokenHighlights(final IElementType tokenType) {
            if (myKeysMap.containsKey(tokenType)) {
                return pack(myKeysMap.get(tokenType));
            }
            return super.getTokenHighlights(tokenType);
        }

        @NotNull
        @Override
        public Lexer getHighlightingLexer() {
            return new EmberJSLexer();