<commit_before>package org.jetbrains.cabal.parser

import org.jetbrains.cabal.parser.*
import com.intellij.psi.tree.IElementType
import kotlin.Pair
import kotlin.MutableMap
import java.util.*

// https://github.com/ghc/packages-Cabal/blob/master/Cabal/Distribution/PackageDescription/Parse.hs

public val PKG_DESCR_FIELDS: Map<String, Pair<IElementType, CabalParser.(Int) -> Boolean>> = mapOf(
    "name"               to Pair(CabalTokelTypes.NAME_FIELD        , { CabalParser.(level: Int) -> this.parseIdValue(CabalTokelTypes.NAME) }      ),
    "version"            to Pair(CabalTokelTypes.VERSION           , { CabalParser.(level: Int) -> this.parseVersionValue() }                     ),
    "cabal-version"      to Pair(CabalTokelTypes.CABAL_VERSION     , { CabalParser.(level: Int) -> this.parseSimpleVersionConstraint() }          ),
    "build-type"         to Pair(CabalTokelTypes.BUILD_TYPE_FIELD  , { CabalParser.(level: Int) -> this.parseIdValue(CabalTokelTypes.BUILD_TYPE) }),
    "license"            to Pair(CabalTokelTypes.LICENSE           , { CabalParser.(level: Int) -> this.parseIdValue(CabalTokelTypes.IDENTIFIER) }),
    "license-file"       to Pair(CabalTokelTypes.LICENSE_FILES     , { CabalParser.(level: Int) -> this.parsePath() }                             ),
//    "license-files"      to Pair(CabalTokelTypes.LICENSE_FILES     , { CabalParser.(level: Int) -> this.parsePathList(level) }                    ),

    "copyright"          to Pair(CabalTokelTypes.SINGLE_VAL        , { CabalParser.(level: Int) -> this.parseFreeForm(level) }                    ),
    "author"             to Pair(CabalTokelTypes.SINGLE_VAL        , { CabalParser.(level: Int) -> this.parseFreeForm(level) }                    ),
    "maintainer"         to Pair(CabalTokelTypes.SINGLE_VAL        , { CabalParser.(level: Int) -> this.parseFreeLine(CabalTokelTypes.E_MAIL) }   ),
    "stability"          to Pair(CabalTokelTypes.SINGLE_VAL        , { CabalParser.(level: Int) -> this.parseFreeForm(level) }                    ),
    "homepage"           to Pair(CabalTokelTypes.SINGLE_VAL        , { CabalParser.(level: Int) -> this.parseFreeLine(CabalTokelTypes.URL) }      ),
    "bug-reports"        to Pair(CabalTokelTypes.SINGLE_VAL        , { CabalParser.(level: Int) -> this.parseFreeLine(CabalTokelTypes.URL) }      ),
    "package-url"        to Pair(CabalTokelTypes.SINGLE_VAL        , { CabalParser.(level: Int) -> this.parseFreeLine(CabalTokelTypes.URL) }      ),
    "synopsis"           to Pair(CabalTokelTypes.SINGLE_VAL        , { CabalParser.(level: Int) -> this.parseFreeForm(level) }                    ),
    "description"        to Pair(CabalTokelTypes.SINGLE_VAL        , { CabalParser.(level: Int) -> this.parseFreeForm(level) }                    ),
    "category"           to Pair(CabalTokelTypes.SINGLE_VAL        , { CabalParser.(level: Int) -> this.parseFreeForm(level) }                    ),

    "tested-with"        to Pair(CabalTokelTypes.TESTED_WITH       , { CabalParser.(level: Int) -> this.parseCompilerList(level) }                ),

    "data-files"         to Pair(CabalTokelTypes.DATA_FILES        , { CabalParser.(level: Int) -> this.parsePathList(level) }                    ),
    "data-dir"           to Pair(CabalTokelTypes.DATA_DIR          , { CabalParser.(level: Int) -> this.parsePath() }                             ),
    "extra-source-files" to Pair(CabalTokelTypes.EXTRA_SOURCE      , { CabalParser.(level: Int) -> this.parsePathList(level) }                    ),
//    "extra-doc-files"    to Pair(CabalTokelTypes.PATHS_FIELD       , { CabalParser.(level: Int) -> this.parsePathList(level) }                    ),
    "extra-tmp-files"    to Pair(CabalTokelTypes.EXTRA_TMP         , { CabalParser.(level: Int) -> this.parsePathList(level) }                    )
)

public val BUILD_INFO_FIELDS: Map<String, Pair<IElementType, CabalParser.(Int) -> Boolean>> = mapOf(
    "build-depends"      to Pair(CabalTokelTypes.BUILD_DEPENDS     , { CabalParser.(level: Int) -> this.parseConstraintList(level) }             ),
    "other-modules"      to Pair(CabalTokelTypes.OTHER_MODULES     , { CabalParser.(level: Int) -> this.parseIdList(level) }                     ),
    "hs-source-dirs"     to Pair(CabalTokelTypes.HS_SOURCE_DIRS    , { CabalParser.(level: Int) -> this.parsePathList(level) }                   ),
    "hs-source-dir"      to Pair(CabalTokelTypes.HS_SOURCE_DIRS    , { CabalParser.(level: Int) -> this.parsePath() }                            ),
    "extensions"         to Pair(CabalTokelTypes.EXTENSIONS        , { CabalParser.(level: Int) -> this.parseIdList(level) }                     ),
    "build-tools"        to Pair(CabalTokelTypes.BUILD_TOOLS       , { CabalParser.(level: Int) -> this.parseConstraintList(level) }             ),
    "buildable"          to Pair(CabalTokelTypes.BUILDABLE         , { CabalParser.(level: Int) -> this.parseBool() }                            ),

    "ghc-options"        to Pair(CabalTokelTypes.MULTI_VAL         , { CabalParser.(level: Int) -> this.parseOptionList(level) }                 ),
    "ghc-prof-options"   to Pair(CabalTokelTypes.MULTI_VAL         , { CabalParser.(level: Int) -> this.parseOptionList(level) }                 ),
    "ghc-shared-options" to Pair(CabalTokelTypes.MULTI_VAL         , { CabalParser.(level: Int) -> this.parseOptionList(level) }                 ),
    "hugs-options"       to Pair(CabalTokelTypes.MULTI_VAL         , { CabalParser.(level: Int) -> this.parseOptionList(level) }                 ),
    "nhc98-options"      to Pair(CabalTokelTypes.MULTI_VAL         , { CabalParser.(level: Int) -> this.parseOptionList(level) }                 ),
    "jhc-options"        to Pair(CabalTokelTypes.MULTI_VAL         , { CabalParser.(level: Int) -> this.parseOptionList(level) }                 ),

    "includes"           to Pair(CabalTokelTypes.INCLUDES          , { CabalParser.(level: Int) -> this.parsePathList(level) }                   ),
    "install-includes"   to Pair(CabalTokelTypes.INSTALL_INCLUDES  , { CabalParser.(level: Int) -> this.parsePathList(level) }                   ),
    "include-dirs"       to Pair(CabalTokelTypes.INCLUDE_DIRS      , { CabalParser.(level: Int) -> this.parsePathList(level) }                   ),

    "c-sources"          to Pair(CabalTokelTypes.C_SOURCES         , { CabalParser.(level: Int) -> this.parsePathList(level) }                   ),

    "extra-libraries"    to Pair(CabalTokelTypes.MULTI_VAL         , { CabalParser.(level: Int) -> this.parseTokenList(level) }                  ),
    "extra-lib-dirs"     to Pair(CabalTokelTypes.EXTRA_LIB_DIRS    , { CabalParser.(level: Int) -> this.parsePathList(level) }                   ),

    "cc-options"         to Pair(CabalTokelTypes.MULTI_VAL         , { CabalParser.(level: Int) -> this.parseOptionList(level) }                 ),
    "cpp-options"        to Pair(CabalTokelTypes.MULTI_VAL         , { CabalParser.(level: Int) -> this.parseOptionList(level) }                 ),
    "ld-options"         to Pair(CabalTokelTypes.MULTI_VAL         , { CabalParser.(level: Int) -> this.parseOptionList(level) }                 ),

    "pkgconfig-depends"  to Pair(CabalTokelTypes.PKG_CONFIG_DEPENDS, { CabalParser.(level: Int) -> this.parseConstraintList(level) }             ),
    "frameworks"         to Pair(CabalTokelTypes.MULTI_VAL         , { CabalParser.(level: Int) -> this.parseTokenList(level) }                  ),

    "default-extensions" to Pair(CabalTokelTypes.MULTI_VAL         , { CabalParser.(level: Int) -> this.parseIdList(level) }                     ),
    "other-extensions"   to Pair(CabalTokelTypes.MULTI_VAL         , { CabalParser.(level: Int) -> this.parseIdList(level) }                     ),
    "default-language"   to Pair(CabalTokelTypes.SINGLE_VAL        , { CabalParser.(level: Int) -> this.parseIdValue(CabalTokelTypes.LANGUAGE) } ),
    "other-languages"    to Pair(CabalTokelTypes.MULTI_VAL         , { CabalParser.(level: Int) -> this.parseLanguageList(level) }               )
)

public val LIBRARY_FIELDS: Map<String, Pair<IElementType, CabalParser.(Int) -> Boolean>> = {
    val res = hashMapOf(
            "exposed-modules"    to Pair(CabalTokelTypes.EXPOSED_MODULES, { CabalParser.(level: Int) -> this.parseIdList(level) }),
            "exposed"            to Pair(CabalTokelTypes.EXPOSED, { CabalParser.(level: Int) -> this.parseBool() })
    )
    res.putAll(BUILD_INFO_FIELDS)
    res
}()

public val EXECUTABLE_FIELDS: Map<String, Pair<IElementType, CabalParser.(Int) -> Boolean>> = {
    var res = hashMapOf(
        "main-is"            to Pair(CabalTokelTypes.MAIN_FILE         , { CabalParser.(level: Int) -> this.parsePath() })
    )
    res.putAll(BUILD_INFO_FIELDS)
    res
}()

public val TEST_SUITE_FIELDS: Map<String, Pair<IElementType, CabalParser.(Int) -> Boolean>> = {
    var res = hashMapOf(
        "type"               to Pair(CabalTokelTypes.TYPE              , { CabalParser.(level: Int) -> this.parseIdValue(CabalTokelTypes.TEST_SUITE_TYPE) }),
        "main-is"            to Pair(CabalTokelTypes.MAIN_FILE         , { CabalParser.(level: Int) -> this.parsePath() }                                  ),
        "test-module"        to Pair(CabalTokelTypes.TEST_MODULE       , { CabalParser.(level: Int) -> this.parseIdValue(CabalTokelTypes.IDENTIFIER) }     )
    )
    res.putAll(BUILD_INFO_FIELDS)
    res
}()

public val BENCHMARK_FIELDS: Map<String, Pair<IElementType, CabalParser.(Int) -> Boolean>> = {
    var res = hashMapOf(
        "type"               to Pair(CabalTokelTypes.TYPE              , { CabalParser.(level: Int) -> this.parseIdValue(CabalTokelTypes.BENCHMARK_TYPE) } ),
        "main-is"            to Pair(CabalTokelTypes.MAIN_FILE         , { CabalParser.(level: Int) -> this.parsePath() }                                  )
    )
    res.putAll(BUILD_INFO_FIELDS)
    res
}()

public val FLAG_FIELDS: Map<String, Pair<IElementType, CabalParser.(Int) -> Boolean>> = mapOf(
    "description"        to Pair(CabalTokelTypes.SINGLE_VAL        , { CabalParser.(level: Int) -> this.parseFreeForm(level) }),
    "default"            to Pair(CabalTokelTypes.BOOL_FIELD        , { CabalParser.(level: Int) -> this.parseBool() }         ),
    "manual"             to Pair(CabalTokelTypes.BOOL_FIELD        , { CabalParser.(level: Int) -> this.parseBool() }         )
)

public val SOURCE_REPO_FIELDS: Map<String, Pair<IElementType, CabalParser.(Int) -> Boolean>> = mapOf(
    "location"           to Pair(CabalTokelTypes.REPO_LOCATION     , { CabalParser.(level: Int) -> this.parseFreeLine(CabalTokelTypes.URL) }     ),
    "type"               to Pair(CabalTokelTypes.TYPE              , { CabalParser.(level: Int) -> this.parseIdValue(CabalTokelTypes.REPO_TYPE) }),
    "subdir"             to Pair(CabalTokelTypes.REPO_SUBDIR       , { CabalParser.(level: Int) -> this.parsePath() }                            ),
    "module"             to Pair(CabalTokelTypes.REPO_MODULE       , { CabalParser.(level: Int) -> this.parseTokenValue(CabalTokelTypes.TOKEN) } ),
    "tag"                to Pair(CabalTokelTypes.REPO_TAG          , { CabalParser.(level: Int) -> this.parseTokenValue(CabalTokelTypes.TOKEN) } ),
    "branch"             to Pair(CabalTokelTypes.SINGLE_VAL        , { CabalParser.(level: Int) -> this.parseTokenValue(CabalTokelTypes.TOKEN) } )
)

public val SECTION_TYPES: Map<String, IElementType> = mapOf(
        "flag"                  to CabalTokelTypes.FLAG          ,
        "executable"            to CabalTokelTypes.EXECUTABLE    ,
        "library"               to CabalTokelTypes.LIBRARY       ,
        "test-suite"            to CabalTokelTypes.TEST_SUITE    ,
        "benchmark"             to CabalTokelTypes.BENCHMARK     ,
        "if"                    to CabalTokelTypes.IF_CONDITION  ,
        "else"                  to CabalTokelTypes.ELSE_CONDITION,
        "source-repository"     to CabalTokelTypes.SOURCE_REPO<commit_msg>code style improved<commit_after>package org.jetbrains.cabal.parser

import org.jetbrains.cabal.parser.*
import com.intellij.psi.tree.IElementType
import kotlin.Pair
import kotlin.MutableMap
import java.util.*

// https://github.com/ghc/packages-Cabal/blob/master/Cabal/Distribution/PackageDescription/Parse.hs

public val PKG_DESCR_FIELDS: Map<String, Pair<IElementType, CabalParser.(Int) -> Boolean>> = mapOf(
    "name"               to Pair(CabalTokelTypes.NAME_FIELD        , { CabalParser.(level: Int) -> this.parseIdValue(CabalTokelTypes.NAME) }      ),
    "version"            to Pair(CabalTokelTypes.VERSION           , { CabalParser.(level: Int) -> this.parseVersionValue() }                     ),
    "cabal-version"      to Pair(CabalTokelTypes.CABAL_VERSION     , { CabalParser.(level: Int) -> this.parseSimpleVersionConstraint() }          ),
    "build-type"         to Pair(CabalTokelTypes.BUILD_TYPE_FIELD  , { CabalParser.(level: Int) -> this.parseIdValue(CabalTokelTypes.BUILD_TYPE) }),
    "license"            to Pair(CabalTokelTypes.LICENSE           , { CabalParser.(level: Int) -> this.parseIdValue(CabalTokelTypes.IDENTIFIER) }),
    "license-file"       to Pair(CabalTokelTypes.LICENSE_FILES     , { CabalParser.(level: Int) -> this.parsePath() }                             ),
    "copyright"          to Pair(CabalTokelTypes.SINGLE_VAL        , CabalParser::parseFreeForm                                                   ),
    "author"             to Pair(CabalTokelTypes.SINGLE_VAL        , CabalParser::parseFreeForm                                                   ),
    "maintainer"         to Pair(CabalTokelTypes.SINGLE_VAL        , { CabalParser.(level: Int) -> this.parseFreeLine(CabalTokelTypes.E_MAIL) }   ),
    "stability"          to Pair(CabalTokelTypes.SINGLE_VAL        , CabalParser::parseFreeForm                                                   ),
    "homepage"           to Pair(CabalTokelTypes.SINGLE_VAL        , { CabalParser.(level: Int) -> this.parseFreeLine(CabalTokelTypes.URL) }      ),
    "bug-reports"        to Pair(CabalTokelTypes.SINGLE_VAL        , { CabalParser.(level: Int) -> this.parseFreeLine(CabalTokelTypes.URL) }      ),
    "package-url"        to Pair(CabalTokelTypes.SINGLE_VAL        , { CabalParser.(level: Int) -> this.parseFreeLine(CabalTokelTypes.URL) }      ),
    "synopsis"           to Pair(CabalTokelTypes.SINGLE_VAL        , CabalParser::parseFreeForm                                                   ),
    "description"        to Pair(CabalTokelTypes.SINGLE_VAL        , CabalParser::parseFreeForm                                                   ),
    "category"           to Pair(CabalTokelTypes.SINGLE_VAL        , CabalParser::parseFreeForm                                                   ),

    "tested-with"        to Pair(CabalTokelTypes.TESTED_WITH       , CabalParser::parseCompilerList                                               ),

    "data-files"         to Pair(CabalTokelTypes.DATA_FILES        , CabalParser::parsePathList                                                   ),
    "data-dir"           to Pair(CabalTokelTypes.DATA_DIR          , { CabalParser.(level: Int) -> this.parsePath() }                             ),
    "extra-source-files" to Pair(CabalTokelTypes.EXTRA_SOURCE      , CabalParser::parsePathList                                                   ),
    "extra-tmp-files"    to Pair(CabalTokelTypes.EXTRA_TMP         , CabalParser::parsePathList                                                   )
)

public val BUILD_INFO_FIELDS: Map<String, Pair<IElementType, CabalParser.(Int) -> Boolean>> = mapOf(
    "build-depends"      to Pair(CabalTokelTypes.BUILD_DEPENDS     , { CabalParser.(level: Int) -> this.parseConstraintList(level) }             ),
    "other-modules"      to Pair(CabalTokelTypes.OTHER_MODULES     , CabalParser::parseIdList                                                    ),
    "hs-source-dirs"     to Pair(CabalTokelTypes.HS_SOURCE_DIRS    , CabalParser::parsePathList                                                  ),
    "hs-source-dir"      to Pair(CabalTokelTypes.HS_SOURCE_DIRS    , { CabalParser.(level: Int) -> this.parsePath() }                            ),
    "extensions"         to Pair(CabalTokelTypes.EXTENSIONS        , CabalParser::parseIdList                                                    ),
    "build-tools"        to Pair(CabalTokelTypes.BUILD_TOOLS       , { CabalParser.(level: Int) -> this.parseConstraintList(level) }             ),
    "buildable"          to Pair(CabalTokelTypes.BUILDABLE         , { CabalParser.(level: Int) -> this.parseBool() }                            ),

    "ghc-options"        to Pair(CabalTokelTypes.MULTI_VAL         , CabalParser::parseOptionList                                                ),
    "ghc-prof-options"   to Pair(CabalTokelTypes.MULTI_VAL         , CabalParser::parseOptionList                                                ),
    "ghc-shared-options" to Pair(CabalTokelTypes.MULTI_VAL         , CabalParser::parseOptionList                                                ),
    "hugs-options"       to Pair(CabalTokelTypes.MULTI_VAL         , CabalParser::parseOptionList                                                ),
    "nhc98-options"      to Pair(CabalTokelTypes.MULTI_VAL         , CabalParser::parseOptionList                                                ),
    "jhc-options"        to Pair(CabalTokelTypes.MULTI_VAL         , CabalParser::parseOptionList                                                ),

    "includes"           to Pair(CabalTokelTypes.INCLUDES          , CabalParser::parsePathList                                                  ),
    "install-includes"   to Pair(CabalTokelTypes.INSTALL_INCLUDES  , CabalParser::parsePathList                                                  ),
    "include-dirs"       to Pair(CabalTokelTypes.INCLUDE_DIRS      , CabalParser::parsePathList                                                  ),

    "c-sources"          to Pair(CabalTokelTypes.C_SOURCES         , CabalParser::parsePathList                                                  ),

    "extra-libraries"    to Pair(CabalTokelTypes.MULTI_VAL         , CabalParser::parseTokenList                                                 ),
    "extra-lib-dirs"     to Pair(CabalTokelTypes.EXTRA_LIB_DIRS    , CabalParser::parsePathList                                                  ),

    "cc-options"         to Pair(CabalTokelTypes.MULTI_VAL         , CabalParser::parseOptionList                                                ),
    "cpp-options"        to Pair(CabalTokelTypes.MULTI_VAL         , CabalParser::parseOptionList                                                ),
    "ld-options"         to Pair(CabalTokelTypes.MULTI_VAL         , CabalParser::parseOptionList                                                ),

    "pkgconfig-depends"  to Pair(CabalTokelTypes.PKG_CONFIG_DEPENDS, { CabalParser.(level: Int) -> this.parseConstraintList(level) }             ),
    "frameworks"         to Pair(CabalTokelTypes.MULTI_VAL         , CabalParser::parseTokenList                                                 ),

    "default-extensions" to Pair(CabalTokelTypes.MULTI_VAL         , CabalParser::parseIdList                                                    ),
    "other-extensions"   to Pair(CabalTokelTypes.MULTI_VAL         , CabalParser::parseIdList                                                    ),
    "default-language"   to Pair(CabalTokelTypes.SINGLE_VAL        , { CabalParser.(level: Int) -> this.parseIdValue(CabalTokelTypes.LANGUAGE) } ),
    "other-languages"    to Pair(CabalTokelTypes.MULTI_VAL         , CabalParser::parseLanguageList                                              )
)

public val LIBRARY_FIELDS: Map<String, Pair<IElementType, CabalParser.(Int) -> Boolean>> = {
    val res = hashMapOf(
            "exposed-modules"    to Pair(CabalTokelTypes.EXPOSED_MODULES, CabalParser::parseIdList                        ),
            "exposed"            to Pair(CabalTokelTypes.EXPOSED        , { CabalParser.(level: Int) -> this.parseBool() })
    )
    res.putAll(BUILD_INFO_FIELDS)
    res
}()

public val EXECUTABLE_FIELDS: Map<String, Pair<IElementType, CabalParser.(Int) -> Boolean>> = {
    var res = hashMapOf(
        "main-is"            to Pair(CabalTokelTypes.MAIN_FILE         , { CabalParser.(level: Int) -> this.parsePath() })
    )
    res.putAll(BUILD_INFO_FIELDS)
    res
}()

public val TEST_SUITE_FIELDS: Map<String, Pair<IElementType, CabalParser.(Int) -> Boolean>> = {
    var res = hashMapOf(
        "type"               to Pair(CabalTokelTypes.TYPE              , { CabalParser.(level: Int) -> this.parseIdValue(CabalTokelTypes.TEST_SUITE_TYPE) }),
        "main-is"            to Pair(CabalTokelTypes.MAIN_FILE         , { CabalParser.(level: Int) -> this.parsePath() }                                  ),
        "test-module"        to Pair(CabalTokelTypes.TEST_MODULE       , { CabalParser.(level: Int) -> this.parseIdValue(CabalTokelTypes.IDENTIFIER) }     )
    )
    res.putAll(BUILD_INFO_FIELDS)
    res
}()

public val BENCHMARK_FIELDS: Map<String, Pair<IElementType, CabalParser.(Int) -> Boolean>> = {
    var res = hashMapOf(
        "type"               to Pair(CabalTokelTypes.TYPE              , { CabalParser.(level: Int) -> this.parseIdValue(CabalTokelTypes.BENCHMARK_TYPE) } ),
        "main-is"            to Pair(CabalTokelTypes.MAIN_FILE         , { CabalParser.(level: Int) -> this.parsePath() }                                  )
    )
    res.putAll(BUILD_INFO_FIELDS)
    res
}()

public val FLAG_FIELDS: Map<String, Pair<IElementType, CabalParser.(Int) -> Boolean>> = mapOf(
    "description"        to Pair(CabalTokelTypes.SINGLE_VAL        , CabalParser::parseFreeForm                      ),
    "default"            to Pair(CabalTokelTypes.BOOL_FIELD        , { CabalParser.(level: Int) -> this.parseBool() }),
    "manual"             to Pair(CabalTokelTypes.BOOL_FIELD        , { CabalParser.(level: Int) -> this.parseBool() })
)

public val SOURCE_REPO_FIELDS: Map<String, Pair<IElementType, CabalParser.(Int) -> Boolean>> = mapOf(
    "location"           to Pair(CabalTokelTypes.REPO_LOCATION     , { CabalParser.(level: Int) -> this.parseFreeLine(CabalTokelTypes.URL) }     ),
    "type"               to Pair(CabalTokelTypes.TYPE              , { CabalParser.(level: Int) -> this.parseIdValue(CabalTokelTypes.REPO_TYPE) }),
    "subdir"             to Pair(CabalTokelTypes.REPO_SUBDIR       , { CabalParser.(level: Int) -> this.parsePath() }                            ),
    "module"             to Pair(CabalTokelTypes.REPO_MODULE       , { CabalParser.(level: Int) -> this.parseTokenValue(CabalTokelTypes.TOKEN) } ),
    "tag"                to Pair(CabalTokelTypes.REPO_TAG          , { CabalParser.(level: Int) -> this.parseTokenValue(CabalTokelTypes.TOKEN) } ),
    "branch"             to Pair(CabalTokelTypes.SINGLE_VAL        , { CabalParser.(level: Int) -> this.parseTokenValue(CabalTokelTypes.TOKEN) } )
)

public val SECTION_TYPES: Map<String, IElementType> = mapOf(
        "flag"                  to CabalTokelTypes.FLAG          ,
        "executable"            to CabalTokelTypes.EXECUTABLE    ,
        "library"               to CabalTokelTypes.LIBRARY       ,
        "test-suite"            to CabalTokelTypes.TEST_SUITE    ,
        "benchmark"             to CabalTokelTypes.BENCHMARK     ,
        "if"                    to CabalTokelTypes.IF_CONDITION  ,
        "else"                  to CabalTokelTypes.ELSE_CONDITION,
        "source-repository"     to CabalTokelTypes.SOURCE_REPO
{'fraction_non_alphanumeric': 0.11283587126165268, 'fraction_numerical': 0.00016872653646602268, 'mean_word_length': 1.887346242844964, 'pattern_counts': {'":': 0, '<': 37, '<?xml version=': 0, '>': 153, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 68, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '253148', 'n_tokens_mistral': 7323, 'n_tokens_neox': 7115, 'n_words': 983}