public TemplateHighlighter(SyntaxHighlighter original) {
      myOriginalHighlighter = original;
      Lexer originalLexer = original.getHighlightingLexer();
      Lexer templateLexer = new FlexAdapter(new FileTemplateTextLexer());
      templateLexer = new MergingLexerAdapter(templateLexer, TOKENS_TO_MERGE);

      myLexer =
          new CompositeLexer(originalLexer, templateLexer) {
            @Override
            protected IElementType getCompositeTokenType(IElementType type1, IElementType type2) {
              if (type2 == FileTemplateTokenType.MACRO
                  || type2 == FileTemplateTokenType.DIRECTIVE) {
                return type2;
              } else {
                return type1;
              }
            }
          };
    }