@Override
  public @Nullable IElementType getTokenType() {
    if (embeddedLexer != null) {
      return embeddedLexer.getTokenType();
    }
    else if (myTokenType != null) {
      return myTokenType;
    }
    else if (highlightMode) {
      IElementType tokenType = super.getTokenType();

      // TODO: fix no DOCTYPE highlighting
      if (tokenType == null) return null;

      if (tokenType == XmlTokenType.XML_NAME) {
        // we need to convert single xml_name for tag name and attribute name into to separate
        // lex types for the highlighting!
        final int state = getState() & BASE_STATE_MASK;

        if (isHtmlTagState(state)) {
          tokenType = XmlTokenType.XML_TAG_NAME;
        }
      }
      else if (tokenType == XmlTokenType.XML_WHITE_SPACE || tokenType == XmlTokenType.XML_REAL_WHITE_SPACE) {
        if (embeddedLexer != null && isWithinTag()) {
          tokenType = XmlTokenType.XML_WHITE_SPACE;
        }
        else {
          tokenType = isWithinTag() ? XmlTokenType.TAG_WHITE_SPACE : XmlTokenType.XML_REAL_WHITE_SPACE;
        }
      }
      else if (tokenType == XmlTokenType.XML_CHAR_ENTITY_REF ||
               tokenType == XmlTokenType.XML_ENTITY_REF_TOKEN
      ) {
        // we need to convert char entity ref & entity ref in comments as comment chars
        final int state = getState() & BASE_STATE_MASK;
        if (state == _HtmlLexer.COMMENT) return XmlTokenType.XML_COMMENT_CHARACTERS;
      }
      return tokenType;
    }
    else {
      IElementType tokenType = super.getTokenType();

      myTokenStart = super.getTokenStart();
      myTokenEnd = super.getTokenEnd();

      HtmlEmbedment embedment = acquireHtmlEmbedmentInfo();
      if (embedment != null) {
        skipEmbedment(embedment);
        myTokenEnd = embedment.getRange().getEndOffset();
        myTokenType = Objects.requireNonNullElse(embedment.getElementType(), XmlTokenType.XML_DATA_CHARACTERS);
      }
      else {
        myTokenType = tokenType;
      }
      return myTokenType;
    }
  }
@Override
  public @Nullable IElementType getTokenType()