// Path: src/main/java/tk/skuro/idea/orgmode/parser/OrgLexer.java
// public class OrgLexer extends FlexAdapter {
// 
//     public OrgLexer() {
//         super(new _OrgLexer((Reader)null));
//     }
// }
// 
// Path: src/main/java/tk/skuro/idea/orgmode/parser/OrgTokenTypes.java
// public interface OrgTokenTypes {
// 
//   IElementType BLOCK = new OrgTokenType("BLOCK");
//   IElementType DRAWER = new OrgTokenType("DRAWER");
//   IElementType OUTLINE_BLOCK = new OrgTokenType("OUTLINE_BLOCK");
//   IElementType TEXT_ELEMENT = new OrgTokenType("TEXT_ELEMENT");
// 
//   IElementType BLOCK_CONTENT = new OrgElementType("BLOCK_CONTENT");
//   IElementType BLOCK_END = new OrgElementType("BLOCK_END");
//   IElementType BLOCK_START = new OrgElementType("BLOCK_START");
//   IElementType BOLD = new OrgElementType("BOLD");
//   IElementType CODE = new OrgElementType("CODE");
//   IElementType COMMENT = new OrgElementType("COMMENT");
//   IElementType CRLF = new OrgElementType("CRLF");
//   IElementType DRAWER_CONTENT = new OrgElementType("DRAWER_CONTENT");
//   IElementType DRAWER_DELIMITER = new OrgElementType("DRAWER_DELIMITER");
//   IElementType KEYWORD = new OrgElementType("KEYWORD");
//   IElementType OUTLINE = new OrgElementType("OUTLINE");
//   IElementType PROPERTIES = new OrgElementType("PROPERTIES");
//   IElementType TEXT = new OrgElementType("TEXT");
//   IElementType UNDERLINE = new OrgElementType("UNDERLINE");
//   IElementType UNMATCHED_DELIMITER = new OrgElementType("UNMATCHED_DELIMITER");
//   IElementType WHITE_SPACE = new OrgElementType("WHITE_SPACE");
// 
//   class Factory {
//     public static PsiElement createElement(ASTNode node) {
//       IElementType type = node.getElementType();
//        if (type == BLOCK) {
//         return new OrgBlockImpl(node);
//       }
//       else if (type == DRAWER) {
//         return new OrgDrawerImpl(node);
//       }
//       else if (type == OUTLINE_BLOCK) {
//         return new OrgOutlineBlockImpl(node);
//       }
//       else if (type == TEXT_ELEMENT) {
//         return new OrgTextElementImpl(node);
//       }
//       throw new AssertionError("Unknown element type: " + type);
//     }
//   }
// }


import com.intellij.psi.tree.TokenSet;
import tk.skuro.idea.orgmode.parser.OrgLexer;
import tk.skuro.idea.orgmode.parser.OrgTokenTypes;
import java.util.HashMap;
import java.util.Map;
import org.jetbrains.annotations.NotNull;
import com.intellij.lexer.Lexer;
import com.intellij.openapi.editor.colors.TextAttributesKey;
import com.intellij.openapi.fileTypes.SyntaxHighlighterBase;
import com.intellij.psi.tree.IElementType;
package tk.skuro.idea.orgmode.highlight;





/**
 * @author Carlo Sciolla
 */
public class OrgSyntaxHighlighter extends SyntaxHighlighterBase {

    /**
     * The map of text attribute keys for each token type.
     */
    protected static final Map<IElementType, TextAttributesKey> ATTRIBUTES = new HashMap<IElementType, TextAttributesKey>();

    static {
        fillMap(ATTRIBUTES, TokenSet.create(OrgTokenTypes.COMMENT), OrgHighlighterColors.COMMENTS_ATTR_KEY);
        fillMap(ATTRIBUTES, TokenSet.create(OrgTokenTypes.OUTLINE), OrgHighlighterColors.OUTLINE_ATTR_KEY);
        fillMap(ATTRIBUTES, TokenSet.create(OrgTokenTypes.BOLD), OrgHighlighterColors.BOLD_ATTR_KEY);
        fillMap(ATTRIBUTES, TokenSet.create(OrgTokenTypes.UNDERLINE), OrgHighlighterColors.UNDERLINE_ATTR_KEY);
        fillMap(ATTRIBUTES, TokenSet.create(OrgTokenTypes.KEYWORD), OrgHighlighterColors.KEYWORD_ATTR_KEY);
        fillMap(ATTRIBUTES, TokenSet.create(OrgTokenTypes.CODE), OrgHighlighterColors.CODE_ATTR_KEY);
        fillMap(ATTRIBUTES, TokenSet.create(OrgTokenTypes.BLOCK_CONTENT), OrgHighlighterColors.BLOCK_CONTENT_ATTR_KEY);
        fillMap(ATTRIBUTES, TokenSet.create(OrgTokenTypes.BLOCK_START, OrgTokenTypes.BLOCK_END),
                OrgHighlighterColors.BLOCK_DELIM_ATTR_KEY);
        // maybe refactor with static import
    }

    @NotNull
    @Override
    public Lexer getHighlightingLexer() {
// Path: src/main/java/tk/skuro/idea/orgmode/parser/OrgLexer.java
// public class OrgLexer extends FlexAdapter {
// 
//     public OrgLexer() {
//         super(new _OrgLexer((Reader)null));
//     }
// }
// 
// Path: src/main/java/tk/skuro/idea/orgmode/parser/OrgTokenTypes.java
// public interface OrgTokenTypes {
// 
//   IElementType BLOCK = new OrgTokenType("BLOCK");
//   IElementType DRAWER = new OrgTokenType("DRAWER");
//   IElementType OUTLINE_BLOCK = new OrgTokenType("OUTLINE_BLOCK");
//   IElementType TEXT_ELEMENT = new OrgTokenType("TEXT_ELEMENT");
// 
//   IElementType BLOCK_CONTENT = new OrgElementType("BLOCK_CONTENT");
//   IElementType BLOCK_END = new OrgElementType("BLOCK_END");
//   IElementType BLOCK_START = new OrgElementType("BLOCK_START");
//   IElementType BOLD = new OrgElementType("BOLD");
//   IElementType CODE = new OrgElementType("CODE");
//   IElementType COMMENT = new OrgElementType("COMMENT");
//   IElementType CRLF = new OrgElementType("CRLF");
//   IElementType DRAWER_CONTENT = new OrgElementType("DRAWER_CONTENT");
//   IElementType DRAWER_DELIMITER = new OrgElementType("DRAWER_DELIMITER");
//   IElementType KEYWORD = new OrgElementType("KEYWORD");
//   IElementType OUTLINE = new OrgElementType("OUTLINE");
//   IElementType PROPERTIES = new OrgElementType("PROPERTIES");
//   IElementType TEXT = new OrgElementType("TEXT");
//   IElementType UNDERLINE = new OrgElementType("UNDERLINE");
//   IElementType UNMATCHED_DELIMITER = new OrgElementType("UNMATCHED_DELIMITER");
//   IElementType WHITE_SPACE = new OrgElementType("WHITE_SPACE");
// 
//   class Factory {
//     public static PsiElement createElement(ASTNode node) {
//       IElementType type = node.getElementType();
//        if (type == BLOCK) {
//         return new OrgBlockImpl(node);
//       }
//       else if (type == DRAWER) {
//         return new OrgDrawerImpl(node);
//       }
//       else if (type == OUTLINE_BLOCK) {
//         return new OrgOutlineBlockImpl(node);
//       }
//       else if (type == TEXT_ELEMENT) {
//         return new OrgTextElementImpl(node);
//       }
//       throw new AssertionError("Unknown element type: " + type);
//     }
//   }
// }


// Path: src/main/java/tk/skuro/idea/orgmode/highlight/OrgSyntaxHighlighter.java
import com.intellij.psi.tree.TokenSet;
import tk.skuro.idea.orgmode.parser.OrgLexer;
import tk.skuro.idea.orgmode.parser.OrgTokenTypes;
import java.util.HashMap;
import java.util.Map;
import org.jetbrains.annotations.NotNull;
import com.intellij.lexer.Lexer;
import com.intellij.openapi.editor.colors.TextAttributesKey;
import com.intellij.openapi.fileTypes.SyntaxHighlighterBase;
import com.intellij.psi.tree.IElementType;

package tk.skuro.idea.orgmode.highlight;





/**
 * @author Carlo Sciolla
 */
public class OrgSyntaxHighlighter extends SyntaxHighlighterBase {

    /**
     * The map of text attribute keys for each token type.
     */
    protected static final Map<IElementType, TextAttributesKey> ATTRIBUTES = new HashMap<IElementType, TextAttributesKey>();

    static {
        fillMap(ATTRIBUTES, TokenSet.create(OrgTokenTypes.COMMENT), OrgHighlighterColors.COMMENTS_ATTR_KEY);
        fillMap(ATTRIBUTES, TokenSet.create(OrgTokenTypes.OUTLINE), OrgHighlighterColors.OUTLINE_ATTR_KEY);
        fillMap(ATTRIBUTES, TokenSet.create(OrgTokenTypes.BOLD), OrgHighlighterColors.BOLD_ATTR_KEY);
        fillMap(ATTRIBUTES, TokenSet.create(OrgTokenTypes.UNDERLINE), OrgHighlighterColors.UNDERLINE_ATTR_KEY);
        fillMap(ATTRIBUTES, TokenSet.create(OrgTokenTypes.KEYWORD), OrgHighlighterColors.KEYWORD_ATTR_KEY);
        fillMap(ATTRIBUTES, TokenSet.create(OrgTokenTypes.CODE), OrgHighlighterColors.CODE_ATTR_KEY);
        fillMap(ATTRIBUTES, TokenSet.create(OrgTokenTypes.BLOCK_CONTENT), OrgHighlighterColors.BLOCK_CONTENT_ATTR_KEY);
        fillMap(ATTRIBUTES, TokenSet.create(OrgTokenTypes.BLOCK_START, OrgTokenTypes.BLOCK_END),
                OrgHighlighterColors.BLOCK_DELIM_ATTR_KEY);
        // maybe refactor with static import
    }

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