// Copyright (c) 2015-2023 Vladimir Schneider <vladimir.schneider@gmail.com> Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.vladsch.md.nav.psi.util;

import com.intellij.psi.TokenType;
import com.intellij.psi.tree.TokenSet;

public interface MdTokenSets extends MdTypes {
    TokenSet WHITESPACE_SET = TokenSet.create(ASIDE_BLOCK_WHITESPACE, BLOCK_QUOTE_WHITESPACE, WHITESPACE, TokenType.WHITE_SPACE);
    TokenSet EOL_SET = TokenSet.create(EOL);
    TokenSet BLANK_LINE_SET = TokenSet.create(BLANK_LINE);
    TokenSet EOL_OR_BLANK_LINE_SET = TokenSet.orSet(BLANK_LINE_SET, EOL_SET);
    TokenSet WHITESPACE_EOL_SET = TokenSet.orSet(WHITESPACE_SET, EOL_SET);
    TokenSet WHITESPACE_BLANK_LINE_SET = TokenSet.orSet(WHITESPACE_SET, BLANK_LINE_SET);
    TokenSet WHITESPACE_EOL_BLANK_LINE_SET = TokenSet.orSet(WHITESPACE_BLANK_LINE_SET, EOL_SET);

    TokenSet ABBREVIATION_SET = TokenSet.create(ABBREVIATION, ABBREVIATION_CLOSE, ABBREVIATION_OPEN);
    TokenSet ABBREVIATION_SHORT_TEXT_SET = TokenSet.create(ABBREVIATION_SHORT_TEXT);
    TokenSet ABBREVIATION_EXPANDED_TEXT_SET = TokenSet.create(ABBREVIATION_EXPANDED_TEXT);
    TokenSet ABBREVIATED_TEXT_SET = TokenSet.create(ABBREVIATED_TEXT);
    TokenSet BLOCK_QUOTE_SET = TokenSet.create(BLOCK_QUOTE, BLOCK_QUOTE_MARKER, BLOCK_QUOTE_WHITESPACE);
    TokenSet ASIDE_BLOCK_SET = TokenSet.create(ASIDE_BLOCK, ASIDE_BLOCK_MARKER, ASIDE_BLOCK_WHITESPACE);
    TokenSet BOLD_MARKER_SET = TokenSet.create(BOLD_MARKER);
    TokenSet UNDERLINE_MARKER_SET = TokenSet.create(UNDERLINE_MARKER);
    TokenSet SUPERSCRIPT_MARKER_SET = TokenSet.create(SUPERSCRIPT_MARKER);
    TokenSet SUBSCRIPT_MARKER_SET = TokenSet.create(SUBSCRIPT_MARKER);
    TokenSet BULLET_LIST_SET = TokenSet.create(BULLET_LIST, BULLET_LIST_ITEM, BULLET_LIST_ITEM_MARKER);
    TokenSet COMMENT_SET = TokenSet.create(COMMENT_OPEN, COMMENT_TEXT, COMMENT_CLOSE);
    TokenSet BLOCK_COMMENT_SET = TokenSet.create(BLOCK_COMMENT_OPEN, BLOCK_COMMENT_TEXT, BLOCK_COMMENT_CLOSE);
    TokenSet COMMENT_FOR_SYNTAX_SET = TokenSet.orSet(COMMENT_SET, BLOCK_COMMENT_SET);
    TokenSet COMMENT_FOR_TODO_SET = TokenSet.create(COMMENT_TEXT, BLOCK_COMMENT_TEXT);
    TokenSet COMMENT_FOR_COMMENT_SET = TokenSet.create(COMMENT, BLOCK_COMMENT);
    TokenSet CODE_SET = TokenSet.create(CODE_TEXT);
    TokenSet CODE_MARKER_SET = TokenSet.create(CODE_MARKER);
    TokenSet GITLAB_MATH_SET = TokenSet.create(GITLAB_MATH_TEXT);
    TokenSet GITLAB_MATH_MARKER_SET = TokenSet.create(GITLAB_MATH_MARKER);
    TokenSet DEFINITION_MARKER_SET = TokenSet.create(DEFINITION_MARKER, DEFINITION_TERM_MARKER);
    TokenSet DEFINITION_TERM_SET = TokenSet.create(DEFINITION_TERM);
    TokenSet EXPLICIT_LINK_SET = TokenSet.create(EXPLICIT_LINK, LINK_REF_TEXT_OPEN, LINK_REF_TEXT_CLOSE, LINK_REF_OPEN, LINK_REF_CLOSE, LINK_REF_TITLE_MARKER);
    TokenSet FOOTNOTE_SET = TokenSet.create(FOOTNOTE, FOOTNOTE_OPEN, FOOTNOTE_CLOSE/*, FOOTNOTE_END*/);
    TokenSet FOOTNOTE_REF_SET = TokenSet.create(FOOTNOTE_REF, FOOTNOTE_REF_OPEN, FOOTNOTE_REF_CLOSE);
    TokenSet FOOTNOTE_ID_SET = TokenSet.create(FOOTNOTE_ID, FOOTNOTE_REF_ID);
    TokenSet ATX_HEADER_SET = TokenSet.create(ATX_HEADER);
    TokenSet SETEXT_HEADER_SET = TokenSet.create(SETEXT_HEADER);
    TokenSet HEADER_TEXT_SET = TokenSet.create(HEADER_TEXT);
    TokenSet HEADER_ATX_MARKER_SET = TokenSet.create(HEADER_ATX_MARKER, SIM_TOC_HEADER_MARKERS);
    TokenSet HEADER_SETEXT_MARKER_SET = TokenSet.create(HEADER_SETEXT_MARKER);
    TokenSet HRULE_SET = TokenSet.create(HRULE_TEXT);
    TokenSet HTML_BLOCK_SET = TokenSet.create(HTML_BLOCK, HTML_BLOCK_TEXT);
    TokenSet JEKYLL_FRONT_MATTER_BLOCK_SET = TokenSet.create(JEKYLL_FRONT_MATTER_BLOCK, FLEXMARK_FRONT_MATTER_BLOCK);
    TokenSet JEKYLL_FRONT_MATTER_MARKER_SET = TokenSet.create(JEKYLL_FRONT_MATTER_OPEN, JEKYLL_FRONT_MATTER_CLOSE, FLEXMARK_FRONT_MATTER_OPEN, FLEXMARK_FRONT_MATTER_CLOSE);

    TokenSet MACRO_SET = TokenSet.create(MACRO_OPEN, MACRO_CLOSE/*, MACRO_END*/);
    TokenSet MACRO_REF_SET = TokenSet.create(MACRO_REF_OPEN, MACRO_REF_CLOSE);
    TokenSet MACRO_ID_SET = TokenSet.create(MACRO_REF_ID_LEAF);

    TokenSet BLOCK_QUOTE_LIKE_SET = TokenSet.create(BLOCK_QUOTE, BLOCK_QUOTE_MARKER, ASIDE_BLOCK, ASIDE_BLOCK_MARKER, BLOCK_QUOTE_WHITESPACE, ASIDE_BLOCK_WHITESPACE);
    TokenSet BLOCK_QUOTE_LIKE_MARKER_SET = TokenSet.create(BLOCK_QUOTE_MARKER, ASIDE_BLOCK_MARKER, BLOCK_QUOTE_WHITESPACE, ASIDE_BLOCK_WHITESPACE);

    TokenSet ATTRIBUTES_MARKER_SET = TokenSet.create(ATTRIBUTES_OPEN, ATTRIBUTES_CLOSE);
    TokenSet ATTRIBUTE_NAME_SET = TokenSet.create(ATTRIBUTE_NAME, ATTRIBUTE_NAME_CLASS, ATTRIBUTE_NAME_ID);
    TokenSet ATTRIBUTE_VALUE_SEP_SET = TokenSet.create(ATTRIBUTE_VALUE_SEP);
    TokenSet ATTRIBUTE_VALUE_MARKER_SET = TokenSet.create(ATTRIBUTE_VALUE_OPEN, ATTRIBUTE_VALUE_CLOSE);

    TokenSet ENUM_REF_FORMAT_SET = TokenSet.create(ENUM_REF_FORMAT_OPEN, ENUM_REF_FORMAT_CLOSE);
    TokenSet ENUM_REF_LINK_SET = TokenSet.create(ENUM_REF_LINK_OPEN, ENUM_REF_LINK_CLOSE);
    TokenSet ENUM_REF_TEXT_SET = TokenSet.create(ENUM_REF_TEXT_OPEN, ENUM_REF_TEXT_CLOSE);
    TokenSet ENUM_REF_ID_SET = TokenSet.create(ENUM_REF_FORMAT_TYPE, ENUM_REF_ID);

    TokenSet ADMONITION_MARKER_SET = TokenSet.create(ADMONITION_MARKER);
    TokenSet ADMONITION_INFO_SET = TokenSet.create(ADMONITION_INFO);
    TokenSet ADMONITION_TITLE_SET = TokenSet.create(ADMONITION_TITLE);

    TokenSet JEKYLL_TAG_MARKER_SET = TokenSet.create(JEKYLL_TAG_OPEN, JEKYLL_TAG_CLOSE, JEKYLL_LINKREF_OPEN, JEKYLL_LINKREF_CLOSE);
    TokenSet JEKYLL_TAG_NAME_SET = TokenSet.create(JEKYLL_TAG_NAME);
    TokenSet JEKYLL_TAG_PARAMETERS_SET = TokenSet.create(JEKYLL_TAG_PARAMETERS);

    TokenSet FLEXMARK_MARKER_SET = TokenSet.create(FLEXMARK_EXAMPLE_OPEN, FLEXMARK_EXAMPLE_CLOSE);
    TokenSet FLEXMARK_EXAMPLE_SECTION_SET = TokenSet.create(FLEXMARK_EXAMPLE_SECTION);
    TokenSet FLEXMARK_EXAMPLE_SECTION_MARKER_SET = TokenSet.create(FLEXMARK_EXAMPLE_SECTION_OPEN, FLEXMARK_EXAMPLE_NUMBER_SEPARATOR, FLEXMARK_EXAMPLE_SECTION_CLOSE);
    TokenSet FLEXMARK_EXAMPLE_NUMBER_SET = TokenSet.create(FLEXMARK_EXAMPLE_NUMBER);
    TokenSet FLEXMARK_EXAMPLE_EXAMPLE_KEYWORD_SET = TokenSet.create(FLEXMARK_EXAMPLE_EXAMPLE_KEYWORD);
    TokenSet FLEXMARK_EXAMPLE_OPTIONS_KEYWORD_SET = TokenSet.create(FLEXMARK_EXAMPLE_OPTIONS_KEYWORD);
    TokenSet FLEXMARK_EXAMPLE_OPTIONS_MARKER_SET = TokenSet.create(FLEXMARK_EXAMPLE_OPTIONS_OPEN, FLEXMARK_EXAMPLE_OPTIONS_CLOSE, FLEXMARK_EXAMPLE_OPTION_SEPARATOR);
    TokenSet FLEXMARK_EXAMPLE_OPTION_SET = TokenSet.create(FLEXMARK_EXAMPLE_OPTION_NAME);
    TokenSet FLEXMARK_EXAMPLE_OPTION_NAME_OR_DISABLED_SET = TokenSet.create(FLEXMARK_EXAMPLE_OPTION_NAME, FLEXMARK_EXAMPLE_OPTION_DISABLED_NAME);
    TokenSet FLEXMARK_EXAMPLE_OPTION_PARAM_SET = TokenSet.create(FLEXMARK_EXAMPLE_OPTION_PARAM);
    TokenSet FLEXMARK_EXAMPLE_OPTION_PARAM_MARKER_SET = TokenSet.create(FLEXMARK_EXAMPLE_OPTION_PARAM_OPEN, FLEXMARK_EXAMPLE_OPTION_PARAM_CLOSE);
    TokenSet FLEXMARK_EXAMPLE_OPTION_IGNORE_SET = TokenSet.create(FLEXMARK_EXAMPLE_OPTION_IGNORE_NAME);
    TokenSet FLEXMARK_EXAMPLE_OPTION_FAIL_SET = TokenSet.create(FLEXMARK_EXAMPLE_OPTION_FAIL_NAME);
    TokenSet FLEXMARK_EXAMPLE_OPTION_BUILT_IN_SET = TokenSet.create(FLEXMARK_EXAMPLE_OPTION_EMBED_TIMED_NAME, FLEXMARK_EXAMPLE_OPTION_TIMED_NAME, FLEXMARK_EXAMPLE_OPTION_NO_FILE_EOL_NAME, FLEXMARK_EXAMPLE_OPTION_FILE_EOL_NAME);
    TokenSet FLEXMARK_EXAMPLE_OPTION_DISABLED_NAME_SET = TokenSet.create(FLEXMARK_EXAMPLE_OPTION_DISABLED_NAME);
    TokenSet FLEXMARK_EXAMPLE_SEPARATOR_SET = TokenSet.create(FLEXMARK_EXAMPLE_SEPARATOR);

    TokenSet FLEXMARK_OPTIONS_SET = TokenSet.create(
            FLEXMARK_EXAMPLE_OPTION_NAME,
            FLEXMARK_EXAMPLE_OPTION_IGNORE_NAME,
            FLEXMARK_EXAMPLE_OPTION_FAIL_NAME,
            FLEXMARK_EXAMPLE_OPTION_EMBED_TIMED_NAME,
            FLEXMARK_EXAMPLE_OPTION_TIMED_NAME,
            FLEXMARK_EXAMPLE_OPTION_NO_FILE_EOL_NAME,
            FLEXMARK_EXAMPLE_OPTION_FILE_EOL_NAME,
            FLEXMARK_EXAMPLE_OPTION_DISABLED_NAME
    );

    TokenSet IMAGE_SET = TokenSet.create(IMAGE, IMAGE_LINK_REF_CLOSE, IMAGE_LINK_REF_OPEN, IMAGE_LINK_REF_TEXT_OPEN, IMAGE_LINK_REF_TEXT_CLOSE, IMAGE_LINK_REF_TITLE_MARKER);
    TokenSet INLINE_HTML_SET = TokenSet.create(INLINE_HTML);
    TokenSet HTML_ENTITY_SET = TokenSet.create(HTML_ENTITY);
    TokenSet ANCHOR_SET = TokenSet.create(ANCHOR, ANCHOR_MARK);
    TokenSet ANCHOR_ID_SET = TokenSet.create(ANCHOR_ID);
    TokenSet EMOJI_MARKER_SET = TokenSet.create(EMOJI_MARKER);
    TokenSet EMOJI_ID_SET = TokenSet.create(EMOJI_ID);
    TokenSet ITALIC_MARKER_SET = TokenSet.create(ITALIC_MARKER);
    TokenSet IMAGE_LINK_REF_SET = TokenSet.create(IMAGE_LINK_REF);
    TokenSet IMAGE_URL_CONTENT_SET = TokenSet.create(IMAGE_URL_CONTENT);
    TokenSet IMAGE_LINK_REF_TITLE_SET = TokenSet.create(IMAGE_LINK_REF_TITLE);
    TokenSet IMAGE_ALT_TEXT_SET = TokenSet.create(IMAGE_LINK_REF_TEXT);
    TokenSet LINK_REF_SET = TokenSet.create(LINK_REF, AUTO_LINK_REF, AUTO_LINK_ELEM);
    TokenSet LINK_REF_TEXT_SET = TokenSet.create(LINK_REF_TEXT);
    TokenSet LINK_REF_TITLE_SET = TokenSet.create(LINK_REF_TITLE);
    TokenSet LINK_REF_ANCHOR_SET = TokenSet.create(LINK_REF_ANCHOR, AUTO_LINK_ANCHOR);
    TokenSet LINK_REF_ANCHOR_MARKER_SET = TokenSet.create(LINK_REF_ANCHOR_MARKER, AUTO_LINK_ANCHOR_MARKER);
    TokenSet LIST_ITEM_SET = TokenSet.create(BULLET_LIST_ITEM, ORDERED_LIST_ITEM, BULLET_LIST_ITEM_MARKER, ORDERED_LIST_ITEM_MARKER);
    TokenSet MAIL_LINK_SET = TokenSet.create(MAIL_LINK);
    TokenSet ORDERED_LIST_SET = TokenSet.create(ORDERED_LIST, ORDERED_LIST_ITEM, ORDERED_LIST_ITEM_MARKER);
    TokenSet QUOTE_SET = TokenSet.create(QUOTE_MARKER);
    TokenSet QUOTED_TEXT_SET = TokenSet.create(QUOTED_TEXT);
    TokenSet TEXT_SET = TokenSet.create(TEXT, PARAGRAPH_BLOCK, TEXT_BLOCK);

    TokenSet AUTO_LINK_SET = TokenSet.create(AUTO_LINK_OPEN, AUTO_LINK_CLOSE);

    TokenSet LIST_ITEM_MARKER_SET = TokenSet.create(ORDERED_LIST_ITEM_MARKER, BULLET_LIST_ITEM_MARKER, TASK_DONE_ITEM_MARKER, TASK_ITEM_MARKER);
    TokenSet LIST_ITEM_MARKER_OR_WHITESPACE_SET = TokenSet.orSet(LIST_ITEM_MARKER_SET, WHITESPACE_SET);

    TokenSet LINK_REF_TYPES = TokenSet.create(
            REFERENCE_LINK_REF,
            IMAGE_LINK_REF,
            LINK_REF,
            AUTO_LINK_REF,
            WIKI_LINK_REF
    );

    TokenSet LINK_ANCHOR_TYPES = TokenSet.create(
            REFERENCE_ANCHOR,
            LINK_REF_ANCHOR,
            AUTO_LINK_ANCHOR,
            WIKI_LINK_REF_ANCHOR
    );

    TokenSet LINK_REF_OR_ANCHOR_TYPES = TokenSet.orSet(LINK_REF_TYPES, LINK_ANCHOR_TYPES);

    TokenSet REFERENCE_IMAGE_SET = TokenSet.create(REFERENCE_IMAGE, REFERENCE_IMAGE_TEXT_OPEN, REFERENCE_IMAGE_TEXT_CLOSE, REFERENCE_IMAGE_REFERENCE_OPEN2, REFERENCE_IMAGE_REFERENCE_CLOSE2);
    TokenSet REFERENCE_IMAGE_REFERENCE_SET = TokenSet.create(REFERENCE_IMAGE_REFERENCE_LEAF);
    TokenSet REFERENCE_IMAGE_TEXT_SET = TokenSet.create(REFERENCE_IMAGE_TEXT);

    TokenSet REFERENCE_LINK_SET = TokenSet.create(REFERENCE_LINK, REFERENCE_LINK_TEXT_OPEN, REFERENCE_LINK_TEXT_CLOSE, REFERENCE_LINK_REFERENCE_OPEN2, REFERENCE_LINK_REFERENCE_CLOSE2);
    TokenSet REFERENCE_LINK_REFERENCE_SET = TokenSet.create(REFERENCE_LINK_REFERENCE_LEAF);
    TokenSet REFERENCE_LINK_TEXT_SET = TokenSet.create(REFERENCE_LINK_TEXT);

    TokenSet REFERENCE_SET = TokenSet.create(REFERENCE, REFERENCE_TEXT_OPEN, REFERENCE_TEXT_CLOSE, REFERENCE_TITLE_MARKER, REFERENCE_IMAGE_REFERENCE_OPEN, REFERENCE_IMAGE_REFERENCE_CLOSE, REFERENCE_LINK_REFERENCE_OPEN, REFERENCE_LINK_REFERENCE_CLOSE, REFERENCE_END, DUMMY_REFERENCE);

    // all references to reference
    TokenSet REFERENCING_ID_SET = TokenSet.create(REFERENCE_IMAGE_REFERENCE_LEAF, REFERENCE_LINK_REFERENCE_LEAF, FOOTNOTE_REF_ID_LEAF, MACRO_REF_ID_LEAF, ABBREVIATED_TEXT);

    TokenSet LINE_MARKER_REFERENCING_ID_SET = TokenSet.create(REFERENCE_IMAGE_REFERENCE_OPEN, REFERENCE_IMAGE_REFERENCE_OPEN2, REFERENCE_LINK_REFERENCE_OPEN, REFERENCE_LINK_REFERENCE_OPEN2);

    TokenSet REFERENCE_LINK_REF_SET = TokenSet.create(REFERENCE_LINK_REF);
    TokenSet REFERENCE_TITLE_SET = TokenSet.create(REFERENCE_TITLE);
    TokenSet REFERENCE_TEXT_SET = TokenSet.create(REFERENCE_TEXT_LEAF);
    TokenSet REFERENCE_ANCHOR_SET = TokenSet.create(REFERENCE_ANCHOR);
    TokenSet REFERENCE_ANCHOR_MARKER_SET = TokenSet.create(REFERENCE_ANCHOR_MARKER);
    TokenSet SMARTS_SET = TokenSet.create(SMARTS);
    TokenSet SPECIAL_TEXT_SET = TokenSet.create(SPECIAL_TEXT);
    TokenSet SPECIAL_TEXT_MARKER_SET = TokenSet.create(SPECIAL_TEXT_MARKER);
    TokenSet LINE_BREAK_SPACES_SET = TokenSet.create(LINE_BREAK_SPACES);
    TokenSet STRIKETHROUGH_MARKER_SET = TokenSet.create(STRIKETHROUGH_MARKER);
    TokenSet TABLE_CAPTION_SET = TokenSet.create(TABLE_CAPTION, TABLE_CAPTION_TEXT);
    TokenSet TABLE_CAPTION_MARKER_SET = TokenSet.create(TABLE_CAPTION_MARKER);
    TokenSet TABLE_SEP_COLUMN_ODD_SET = TokenSet.create(TABLE_SEP_COLUMN_ODD);
    TokenSet TABLE_SEP_COLUMN_EVEN_SET = TokenSet.create(TABLE_SEP_COLUMN_EVEN);
    TokenSet TABLE_SEPARATOR_ROW_SET = TokenSet.create(TABLE_SEP_ROW_ODD);
    TokenSet TABLE_ROW_EVEN_SET = TokenSet.create(TABLE_ROW_EVEN);
    TokenSet TABLE_ROW_ODD_SET = TokenSet.create(TABLE_ROW_ODD);
    TokenSet TABLE_HDR_ROW_EVEN_SET = TokenSet.create(TABLE_HDR_ROW_EVEN);
    TokenSet TABLE_HDR_ROW_ODD_SET = TokenSet.create(TABLE_HDR_ROW_ODD);
    TokenSet TABLE_SET = TokenSet.create(TABLE, TABLE_BODY, TABLE_HEADER, TABLE_ROW, TABLE_CELL, TABLE_MARKER);
    TokenSet TASK_ITEM_MARKER_SET = TokenSet.create(TASK_ITEM_MARKER);
    TokenSet TASK_DONE_MARKER_ITEM_SET = TokenSet.create(TASK_DONE_ITEM_MARKER);
    TokenSet TOC_SET = TokenSet.create(TOC, SIM_TOC_KEYWORD, TOC_KEYWORD);
    TokenSet GEN_CONTENT_SET = TokenSet.create(GEN_CONTENT);
    TokenSet TOC_MARKER_SET = TokenSet.create(TOC_OPEN, TOC_CLOSE, SIM_TOC_OPEN, SIM_TOC_CLOSE, SIM_TOC_TITLE_MARKER);
    TokenSet TOC_OPTION_SET = TokenSet.create(TOC_OPTION, SIM_TOC_OPTION, SIM_TOC_OPTIONS);
    TokenSet SIM_TOC_TITLE_SET = TokenSet.create(SIM_TOC_TITLE);
    TokenSet VERBATIM_SET = TokenSet.create(VERBATIM);
    TokenSet VERBATIM_MARKER_SET = TokenSet.create(VERBATIM_OPEN, VERBATIM_CLOSE);
    TokenSet VERBATIM_CONTENT_SET = TokenSet.create(VERBATIM_CONTENT);
    TokenSet VERBATIM_LANG_SET = TokenSet.create(VERBATIM_LANG);
    TokenSet WIKI_LINK_SET = TokenSet.create(WIKI_LINK_OPEN, WIKI_LINK_CLOSE);
    TokenSet WIKI_LINK_SEPARATOR_SET = TokenSet.create(WIKI_LINK_SEPARATOR);
    TokenSet WIKI_LINK_REF_SET = TokenSet.create(WIKI_LINK_REF);
    TokenSet WIKI_LINK_REF_ANCHOR_MARKER_SET = TokenSet.create(WIKI_LINK_REF_ANCHOR_MARKER);
    TokenSet WIKI_LINK_REF_ANCHOR_SET = TokenSet.create(WIKI_LINK_REF_ANCHOR);
    TokenSet WIKI_LINK_TEXT_SET = TokenSet.create(WIKI_LINK_TEXT);

    TokenSet TEXT_FOR_SYNTAX_SET = TokenSet.create(TEXT, EOL, BLANK_LINE, WHITESPACE);

    TokenSet BOLD_SET = TokenSet.create(BOLD_TEXT);
    TokenSet UNDERLINE_SET = TokenSet.create(UNDERLINE_TEXT);
    TokenSet SUPERSCRIPT_SET = TokenSet.create(SUPERSCRIPT_TEXT);
    TokenSet SUBSCRIPT_SET = TokenSet.create(SUBSCRIPT_TEXT);
    TokenSet STRIKETHROUGH_SET = TokenSet.create(STRIKETHROUGH_TEXT);
    TokenSet ITALIC_SET = TokenSet.create(ITALIC_TEXT);
    TokenSet TABLE_CELL_REVEN_CEVEN_SET = TokenSet.create(TABLE_CELL_REVEN_CEVEN);
    TokenSet TABLE_CELL_REVEN_CODD_SET = TokenSet.create(TABLE_CELL_REVEN_CODD);
    TokenSet TABLE_CELL_RODD_CEVEN_SET = TokenSet.create(TABLE_CELL_RODD_CEVEN);
    TokenSet TABLE_CELL_RODD_CODD_SET = TokenSet.create(TABLE_CELL_RODD_CODD);
    TokenSet TABLE_HDR_CELL_REVEN_CEVEN_SET = TokenSet.create(TABLE_HDR_CELL_REVEN_CEVEN);
    TokenSet TABLE_HDR_CELL_REVEN_CODD_SET = TokenSet.create(TABLE_HDR_CELL_REVEN_CODD);
    TokenSet TABLE_HDR_CELL_RODD_CEVEN_SET = TokenSet.create(TABLE_HDR_CELL_RODD_CEVEN);
    TokenSet TABLE_HDR_CELL_RODD_CODD_SET = TokenSet.create(TABLE_HDR_CELL_RODD_CODD);

    TokenSet TABLE_TEXT_SET = TokenSet.create(
            TABLE_CELL_REVEN_CEVEN,
            TABLE_CELL_REVEN_CODD,
            TABLE_CELL_RODD_CEVEN,
            TABLE_CELL_RODD_CODD,
            TABLE_HDR_CELL_REVEN_CEVEN,
            TABLE_HDR_CELL_REVEN_CODD,
            TABLE_HDR_CELL_RODD_CEVEN,
            TABLE_HDR_CELL_RODD_CODD,
            TABLE_CAPTION
    );

    TokenSet TASK_LIST_ITEM_MARKERS = TokenSet.create(TASK_ITEM_MARKER, TASK_DONE_ITEM_MARKER);

    // CAUTION: Non Membership in this and wrapping blocks is used to to find
    //   the wrapping block element. Screw this up and all smart keys and handlers will fail.
    TokenSet NON_WRAPPING_BLOCK_ELEMENTS = TokenSet.create(
            ABBREVIATION,
            ADMONITION_BLOCK,
            ATX_HEADER,
            BLANK_LINE,
            BLOCK_COMMENT,
            BULLET_LIST,
            DEFINITION_LIST,
            DEFINITION_TERM,
            ENUM_REF_FORMAT,
            FLEXMARK_EXAMPLE,
            FLEXMARK_EXAMPLE_AST,
            FLEXMARK_EXAMPLE_HTML,
            FLEXMARK_EXAMPLE_SOURCE,
            FLEXMARK_FRONT_MATTER_BLOCK,
            FLEXMARK_FRONT_MATTER_BLOCK_ELEM,
            GITLAB_BLOCK_QUOTE,
            HRULE,
            HTML_BLOCK,
            HTML_BLOCK_TEXT,
            JEKYLL_FRONT_MATTER_BLOCK,
            JEKYLL_FRONT_MATTER_BLOCK_ELEM,
            MACRO,
            MACRO_TEXT,
            ORDERED_LIST,
            REFERENCE,
            SETEXT_HEADER,
            SIM_TOC,
            TABLE,
            TABLE_BODY,
            TABLE_HEADER,
            VERBATIM
    );

    // CAUTION: Non Membership in this and non-wrapping blocks is used to to find
    //   the wrapping block element. Screw this up and all smart keys and handlers will fail.
    // wrapping or can contain wrapping elements
    TokenSet WRAPPING_BLOCK_ELEMENTS = TokenSet.create(
            BLOCK_QUOTE,
            ASIDE_BLOCK,
            BULLET_LIST_ITEM,
            DEFINITION,
            FOOTNOTE,
            ORDERED_LIST_ITEM,
            PARAGRAPH_BLOCK
            //ASIDE_BLOCK,
            //BLOCK_QUOTE,
            //BULLET_LIST_ITEM,
            //DEFINITION,
            //FOOTNOTE,
            //ORDERED_LIST_ITEM,
            //PARAGRAPH_BLOCK,
    );

    TokenSet CAN_CONTAIN_TASKS_OR_HEADERS = TokenSet.create(
            ADMONITION_BLOCK,
            ASIDE_BLOCK,
            ATX_HEADER,
            BLOCK_QUOTE,
            BULLET_LIST,
            BULLET_LIST_ITEM,
            DEFINITION,
            DEFINITION_LIST,
            FOOTNOTE,
            FOOTNOTE_TEXT,
            GITLAB_BLOCK_QUOTE,
            MACRO,
            MACRO_TEXT,
            ORDERED_LIST,
            ORDERED_LIST_ITEM,
            SETEXT_HEADER
    );

    TokenSet NON_TEXT_BLOCK_ELEMENTS = TokenSet.create(
            BLANK_LINE,
            BLOCK_COMMENT,
            HRULE,
            HTML_BLOCK,
            HTML_BLOCK_TEXT,
            JEKYLL_FRONT_MATTER_BLOCK,
            JEKYLL_FRONT_MATTER_BLOCK_ELEM,
            SIM_TOC,
            VERBATIM
    );

    // NOTE: Non Membership in this is used to to find
    //   the wrapping block element. Screw this up and all smart keys and handlers will fail.
    TokenSet BLOCK_ELEMENT_SET = TokenSet.orSet(WRAPPING_BLOCK_ELEMENTS, NON_WRAPPING_BLOCK_ELEMENTS);

    TokenSet TABLE_ROW_ELEMENTS = TokenSet.orSet(
            TABLE_SEPARATOR_ROW_SET,
            TABLE_ROW_EVEN_SET,
            TABLE_ROW_ODD_SET,
            TABLE_HDR_ROW_EVEN_SET,
            TABLE_HDR_ROW_ODD_SET
    );

    TokenSet LIST_ELEMENT_TYPES = TokenSet.create(ORDERED_LIST, BULLET_LIST);

    TokenSet LIST_ITEM_ELEMENT_TYPES = TokenSet.create(ORDERED_LIST_ITEM, BULLET_LIST_ITEM);

    TokenSet LIST_BLOCK_ITEM_ELEMENT_TYPES = TokenSet.create(ORDERED_LIST_ITEM, BULLET_LIST_ITEM, DEFINITION);
    TokenSet LIST_BLOCK_ELEMENT_TYPES = TokenSet.create(ORDERED_LIST, BULLET_LIST, DEFINITION_LIST);

    TokenSet NON_TEXT_INLINE_ELEMENTS = TokenSet.create(
            ANCHOR,
            ANCHOR_ID,
            ANCHOR_MARK,
            AUTO_LINK_OPEN,
            AUTO_LINK, AUTO_LINK_ELEM,
            AUTO_LINK_ANCHOR_MARKER,
            AUTO_LINK_ANCHOR,
            AUTO_LINK_CLOSE,
            COMMENT_OPEN,
            COMMENT_TEXT,
            COMMENT_CLOSE,
            EXPLICIT_LINK,
            FOOTNOTE_REF,
            FOOTNOTE_REF_CLOSE,
            FOOTNOTE_REF_ID,
            FOOTNOTE_REF_ID_LEAF,
            FOOTNOTE_REF_OPEN,
            HTML_ENTITY,
            IMAGE_LINK_REF,
            IMAGE_LINK_REF_CLOSE,
            IMAGE_LINK_REF_OPEN,
            IMAGE_LINK_REF_TEXT,
            IMAGE_LINK_REF_TEXT_CLOSE,
            IMAGE_LINK_REF_TEXT_OPEN,
            IMAGE_LINK_REF_TITLE,
            IMAGE_LINK_REF_TITLE_MARKER,
            GITLAB_DEL_MARKER,
            GITLAB_INS_MARKER,
            GITLAB_MATH,
            GITLAB_MATH_MARKER,
            GITLAB_MATH_TEXT,
            INLINE_HTML,
            GITLAB_BLOCK_QUOTE_INFO,
            GITLAB_BLOCK_QUOTE_MARKER,
            LINE_BREAK_SPACES,
            LINK_REF_ANCHOR,
            LINK_REF_ANCHOR_MARKER,
            LINK_REF_CLOSE,
            LINK_REF_OPEN,
            LINK_REF_TEXT,
            LINK_REF_TEXT_CLOSE,
            LINK_REF_TEXT_OPEN,
            LINK_REF_TITLE,
            LINK_REF_TITLE_MARKER,
            REFERENCE_IMAGE_REFERENCE,
            REFERENCE_IMAGE_REFERENCE_CLOSE,
            REFERENCE_IMAGE_REFERENCE_CLOSE2,
            REFERENCE_IMAGE_REFERENCE_OPEN,
            REFERENCE_IMAGE_REFERENCE_OPEN2,
            REFERENCE_LINK_REFERENCE,
            REFERENCE_LINK_REFERENCE_CLOSE,
            REFERENCE_LINK_REFERENCE_CLOSE2,
            REFERENCE_LINK_REFERENCE_OPEN,
            REFERENCE_LINK_REFERENCE_OPEN2,
            SMARTS,
            SPECIAL_TEXT,
            WIKI_LINK,
            WIKI_LINK_OPEN, WIKI_LINK_CLOSE,
            WIKI_LINK_REF,
            WIKI_LINK_REF_ANCHOR,
            WIKI_LINK_REF_ANCHOR_MARKER,
            WIKI_LINK_SEPARATOR,
            WIKI_LINK_TEXT
    );

    // elements not wrapped if exceeding wrapping margin
    TokenSet NON_BREAK_INLINE_ELEMENTS = TokenSet.create(
            EXPLICIT_LINK,
            FOOTNOTE_REF,
            IMAGE,
            REFERENCE_IMAGE,
            REFERENCE_LINK,
            ATTRIBUTES,
            WIKI_LINK,
            COMMENT,
            GITLAB_MATH
    );

    // elements containing EOL will not wrap across EOL
    TokenSet KEEP_EMBEDDED_EOL_INLINE_ELEMENTS = TokenSet.create(
            IMAGE_URL_CONTENT,
            IMAGE,
            GITLAB_MATH
    );

    TokenSet LINK_ELEMENT_CLOSE_MARKERS = TokenSet.create(
            IMAGE_LINK_REF_CLOSE,
            IMAGE_LINK_REF_TEXT_CLOSE,
            LINK_REF_CLOSE,
            LINK_REF_TEXT_CLOSE,
            REFERENCE_TEXT_CLOSE
    );
}
