def METHOD_NAME(repository_ctx):
    if repository_ctx.os.environ.get("KYTHE_DO_NOT_DETECT_BAZEL_TOOLCHAINS", "0") == "1":
        repository_ctx.file("BUILD.bazel", "# Toolchain detection disabled by KYTHE_DO_NOT_DETECT_BAZEL_TOOLCHAINS")
        return
    flex = _check_flex_version(repository_ctx, "2.6")
    bison = repository_ctx.os.environ.get("BISON", repository_ctx.which("bison"))
    if not bison:
        fail("Unable to find bison binary")
    repository_ctx.file(
        "WORKSPACE",
        content = "workspace(name=\"%s\")" % (repository_ctx.name,),
        executable = False,
    )
    repository_ctx.file(
        "BUILD.bazel",
        content = "\n".join([
            "load(\"@io_kythe//tools/build_rules/lexyacc:lexyacc.bzl\", \"lexyacc_toolchain\")",
            "package(default_visibility=[\"//visibility:public\"])",
            "lexyacc_toolchain(",
            "  name = \"lexyacc_local\",",
            "  lex_path = \"%s\"," % flex,
            "  yacc_path = \"%s\"," % bison,
            ")",
        ]),
    )