Python: undo tree-sitter update

This commit is contained in:
Paolo Tranquilli
2025-02-17 15:52:45 +01:00
parent df305d6b52
commit 342bff6125
14 changed files with 303 additions and 92 deletions

View File

@@ -62,8 +62,8 @@ use_repo(
"vendor_py__cc-1.2.14",
"vendor_py__clap-4.5.29",
"vendor_py__regex-1.11.1",
"vendor_py__tree-sitter-0.24.7",
"vendor_py__tree-sitter-graph-0.12.0",
"vendor_py__tree-sitter-0.20.10",
"vendor_py__tree-sitter-graph-0.7.0",
)
# deps for ruby+rust

View File

@@ -11,7 +11,7 @@ load("@rules_rust//rust:defs.bzl", "rust_library")
package(default_visibility = ["//visibility:public"])
rust_library(
name = "streaming_iterator",
name = "ahash",
srcs = glob(
include = ["**/*.rs"],
allow_empty = True,
@@ -29,13 +29,13 @@ rust_library(
],
),
crate_root = "src/lib.rs",
edition = "2021",
edition = "2018",
rustc_flags = [
"--cap-lints=allow",
],
tags = [
"cargo-bazel",
"crate-name=streaming-iterator",
"crate-name=ahash",
"manual",
"noclippy",
"norustfmt",
@@ -79,5 +79,5 @@ rust_library(
"@rules_rust//rust/platform:x86_64-unknown-uefi": [],
"//conditions:default": ["@platforms//:incompatible"],
}),
version = "0.1.9",
version = "0.4.8",
)

View File

@@ -68,26 +68,26 @@ alias(
)
alias(
name = "tree-sitter-0.24.7",
actual = "@vendor_py__tree-sitter-0.24.7//:tree_sitter",
name = "tree-sitter-0.20.10",
actual = "@vendor_py__tree-sitter-0.20.10//:tree_sitter",
tags = ["manual"],
)
alias(
name = "tree-sitter",
actual = "@vendor_py__tree-sitter-0.24.7//:tree_sitter",
actual = "@vendor_py__tree-sitter-0.20.10//:tree_sitter",
tags = ["manual"],
)
alias(
name = "tree-sitter-graph-0.12.0",
actual = "@vendor_py__tree-sitter-graph-0.12.0//:tree_sitter_graph",
name = "tree-sitter-graph-0.7.0",
actual = "@vendor_py__tree-sitter-graph-0.7.0//:tree_sitter_graph",
tags = ["manual"],
)
alias(
name = "tree-sitter-graph",
actual = "@vendor_py__tree-sitter-graph-0.12.0//:tree_sitter_graph",
actual = "@vendor_py__tree-sitter-graph-0.7.0//:tree_sitter_graph",
tags = ["manual"],
)

View File

@@ -11,7 +11,7 @@ load("@rules_rust//rust:defs.bzl", "rust_library")
package(default_visibility = ["//visibility:public"])
rust_library(
name = "tree_sitter_language",
name = "cfg_if",
srcs = glob(
include = ["**/*.rs"],
allow_empty = True,
@@ -28,14 +28,14 @@ rust_library(
"WORKSPACE.bazel",
],
),
crate_root = "language.rs",
edition = "2021",
crate_root = "src/lib.rs",
edition = "2018",
rustc_flags = [
"--cap-lints=allow",
],
tags = [
"cargo-bazel",
"crate-name=tree-sitter-language",
"crate-name=cfg-if",
"manual",
"noclippy",
"norustfmt",
@@ -79,5 +79,5 @@ rust_library(
"@rules_rust//rust/platform:x86_64-unknown-uefi": [],
"//conditions:default": ["@platforms//:incompatible"],
}),
version = "0.1.4",
version = "1.0.0",
)

View File

@@ -0,0 +1,90 @@
###############################################################################
# @generated
# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To
# regenerate this file, run the following:
#
# bazel run @@//misc/bazel/3rdparty:vendor_py_deps
###############################################################################
load("@rules_rust//rust:defs.bzl", "rust_library")
package(default_visibility = ["//visibility:public"])
rust_library(
name = "hashbrown",
srcs = glob(
include = ["**/*.rs"],
allow_empty = True,
),
compile_data = glob(
include = ["**"],
allow_empty = True,
exclude = [
"**/* *",
".tmp_git_root/**/*",
"BUILD",
"BUILD.bazel",
"WORKSPACE",
"WORKSPACE.bazel",
],
),
crate_features = [
"ahash",
"inline-more",
],
crate_root = "src/lib.rs",
edition = "2018",
rustc_flags = [
"--cap-lints=allow",
],
tags = [
"cargo-bazel",
"crate-name=hashbrown",
"manual",
"noclippy",
"norustfmt",
],
target_compatible_with = select({
"@rules_rust//rust/platform:aarch64-apple-darwin": [],
"@rules_rust//rust/platform:aarch64-apple-ios": [],
"@rules_rust//rust/platform:aarch64-apple-ios-sim": [],
"@rules_rust//rust/platform:aarch64-linux-android": [],
"@rules_rust//rust/platform:aarch64-pc-windows-msvc": [],
"@rules_rust//rust/platform:aarch64-unknown-fuchsia": [],
"@rules_rust//rust/platform:aarch64-unknown-linux-gnu": [],
"@rules_rust//rust/platform:aarch64-unknown-nixos-gnu": [],
"@rules_rust//rust/platform:aarch64-unknown-nto-qnx710": [],
"@rules_rust//rust/platform:aarch64-unknown-uefi": [],
"@rules_rust//rust/platform:arm-unknown-linux-gnueabi": [],
"@rules_rust//rust/platform:armv7-linux-androideabi": [],
"@rules_rust//rust/platform:armv7-unknown-linux-gnueabi": [],
"@rules_rust//rust/platform:i686-apple-darwin": [],
"@rules_rust//rust/platform:i686-linux-android": [],
"@rules_rust//rust/platform:i686-pc-windows-msvc": [],
"@rules_rust//rust/platform:i686-unknown-freebsd": [],
"@rules_rust//rust/platform:i686-unknown-linux-gnu": [],
"@rules_rust//rust/platform:powerpc-unknown-linux-gnu": [],
"@rules_rust//rust/platform:riscv32imc-unknown-none-elf": [],
"@rules_rust//rust/platform:riscv64gc-unknown-none-elf": [],
"@rules_rust//rust/platform:s390x-unknown-linux-gnu": [],
"@rules_rust//rust/platform:thumbv7em-none-eabi": [],
"@rules_rust//rust/platform:thumbv8m.main-none-eabi": [],
"@rules_rust//rust/platform:wasm32-unknown-unknown": [],
"@rules_rust//rust/platform:wasm32-wasip1": [],
"@rules_rust//rust/platform:x86_64-apple-darwin": [],
"@rules_rust//rust/platform:x86_64-apple-ios": [],
"@rules_rust//rust/platform:x86_64-linux-android": [],
"@rules_rust//rust/platform:x86_64-pc-windows-msvc": [],
"@rules_rust//rust/platform:x86_64-unknown-freebsd": [],
"@rules_rust//rust/platform:x86_64-unknown-fuchsia": [],
"@rules_rust//rust/platform:x86_64-unknown-linux-gnu": [],
"@rules_rust//rust/platform:x86_64-unknown-nixos-gnu": [],
"@rules_rust//rust/platform:x86_64-unknown-none": [],
"@rules_rust//rust/platform:x86_64-unknown-uefi": [],
"//conditions:default": ["@platforms//:incompatible"],
}),
version = "0.9.1",
deps = [
"@vendor_py__ahash-0.4.8//:ahash",
],
)

View File

@@ -0,0 +1,92 @@
###############################################################################
# @generated
# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To
# regenerate this file, run the following:
#
# bazel run @@//misc/bazel/3rdparty:vendor_py_deps
###############################################################################
load("@rules_rust//rust:defs.bzl", "rust_library")
package(default_visibility = ["//visibility:public"])
rust_library(
name = "string_interner",
srcs = glob(
include = ["**/*.rs"],
allow_empty = True,
),
compile_data = glob(
include = ["**"],
allow_empty = True,
exclude = [
"**/* *",
".tmp_git_root/**/*",
"BUILD",
"BUILD.bazel",
"WORKSPACE",
"WORKSPACE.bazel",
],
),
crate_features = [
"backends",
"inline-more",
"std",
],
crate_root = "src/lib.rs",
edition = "2018",
rustc_flags = [
"--cap-lints=allow",
],
tags = [
"cargo-bazel",
"crate-name=string-interner",
"manual",
"noclippy",
"norustfmt",
],
target_compatible_with = select({
"@rules_rust//rust/platform:aarch64-apple-darwin": [],
"@rules_rust//rust/platform:aarch64-apple-ios": [],
"@rules_rust//rust/platform:aarch64-apple-ios-sim": [],
"@rules_rust//rust/platform:aarch64-linux-android": [],
"@rules_rust//rust/platform:aarch64-pc-windows-msvc": [],
"@rules_rust//rust/platform:aarch64-unknown-fuchsia": [],
"@rules_rust//rust/platform:aarch64-unknown-linux-gnu": [],
"@rules_rust//rust/platform:aarch64-unknown-nixos-gnu": [],
"@rules_rust//rust/platform:aarch64-unknown-nto-qnx710": [],
"@rules_rust//rust/platform:aarch64-unknown-uefi": [],
"@rules_rust//rust/platform:arm-unknown-linux-gnueabi": [],
"@rules_rust//rust/platform:armv7-linux-androideabi": [],
"@rules_rust//rust/platform:armv7-unknown-linux-gnueabi": [],
"@rules_rust//rust/platform:i686-apple-darwin": [],
"@rules_rust//rust/platform:i686-linux-android": [],
"@rules_rust//rust/platform:i686-pc-windows-msvc": [],
"@rules_rust//rust/platform:i686-unknown-freebsd": [],
"@rules_rust//rust/platform:i686-unknown-linux-gnu": [],
"@rules_rust//rust/platform:powerpc-unknown-linux-gnu": [],
"@rules_rust//rust/platform:riscv32imc-unknown-none-elf": [],
"@rules_rust//rust/platform:riscv64gc-unknown-none-elf": [],
"@rules_rust//rust/platform:s390x-unknown-linux-gnu": [],
"@rules_rust//rust/platform:thumbv7em-none-eabi": [],
"@rules_rust//rust/platform:thumbv8m.main-none-eabi": [],
"@rules_rust//rust/platform:wasm32-unknown-unknown": [],
"@rules_rust//rust/platform:wasm32-wasip1": [],
"@rules_rust//rust/platform:x86_64-apple-darwin": [],
"@rules_rust//rust/platform:x86_64-apple-ios": [],
"@rules_rust//rust/platform:x86_64-linux-android": [],
"@rules_rust//rust/platform:x86_64-pc-windows-msvc": [],
"@rules_rust//rust/platform:x86_64-unknown-freebsd": [],
"@rules_rust//rust/platform:x86_64-unknown-fuchsia": [],
"@rules_rust//rust/platform:x86_64-unknown-linux-gnu": [],
"@rules_rust//rust/platform:x86_64-unknown-nixos-gnu": [],
"@rules_rust//rust/platform:x86_64-unknown-none": [],
"@rules_rust//rust/platform:x86_64-unknown-uefi": [],
"//conditions:default": ["@platforms//:incompatible"],
}),
version = "0.12.2",
deps = [
"@vendor_py__cfg-if-1.0.0//:cfg_if",
"@vendor_py__hashbrown-0.9.1//:hashbrown",
],
)

View File

@@ -29,10 +29,6 @@ rust_library(
"WORKSPACE.bazel",
],
),
crate_features = [
"default",
"std",
],
crate_root = "binding_rust/lib.rs",
edition = "2021",
rustc_flags = [
@@ -84,13 +80,10 @@ rust_library(
"@rules_rust//rust/platform:x86_64-unknown-uefi": [],
"//conditions:default": ["@platforms//:incompatible"],
}),
version = "0.24.7",
version = "0.20.10",
deps = [
"@vendor_py__regex-1.11.1//:regex",
"@vendor_py__regex-syntax-0.8.5//:regex_syntax",
"@vendor_py__streaming-iterator-0.1.9//:streaming_iterator",
"@vendor_py__tree-sitter-0.24.7//:build_script_build",
"@vendor_py__tree-sitter-language-0.1.4//:tree_sitter_language",
"@vendor_py__tree-sitter-0.20.10//:build_script_build",
],
)
@@ -113,10 +106,6 @@ cargo_build_script(
"WORKSPACE.bazel",
],
),
crate_features = [
"default",
"std",
],
crate_name = "build_script_build",
crate_root = "binding_rust/build.rs",
data = glob(
@@ -132,7 +121,6 @@ cargo_build_script(
],
),
edition = "2021",
links = "tree-sitter",
pkg_name = "tree-sitter",
rustc_flags = [
"--cap-lints=allow",
@@ -144,7 +132,7 @@ cargo_build_script(
"noclippy",
"norustfmt",
],
version = "0.24.7",
version = "0.20.10",
visibility = ["//visibility:private"],
deps = [
"@vendor_py__cc-1.2.14//:cc",

View File

@@ -79,15 +79,15 @@ rust_library(
"@rules_rust//rust/platform:x86_64-unknown-uefi": [],
"//conditions:default": ["@platforms//:incompatible"],
}),
version = "0.12.0",
version = "0.7.0",
deps = [
"@vendor_py__log-0.4.25//:log",
"@vendor_py__regex-1.11.1//:regex",
"@vendor_py__serde-1.0.217//:serde",
"@vendor_py__serde_json-1.0.138//:serde_json",
"@vendor_py__smallvec-1.14.0//:smallvec",
"@vendor_py__streaming-iterator-0.1.9//:streaming_iterator",
"@vendor_py__string-interner-0.12.2//:string_interner",
"@vendor_py__thiserror-1.0.69//:thiserror",
"@vendor_py__tree-sitter-0.24.7//:tree_sitter",
"@vendor_py__tree-sitter-0.20.10//:tree_sitter",
],
)

80
misc/bazel/3rdparty/py_deps/defs.bzl generated vendored
View File

@@ -298,13 +298,13 @@ _NORMAL_DEPENDENCIES = {
"anyhow": Label("@vendor_py__anyhow-1.0.95//:anyhow"),
"clap": Label("@vendor_py__clap-4.5.29//:clap"),
"regex": Label("@vendor_py__regex-1.11.1//:regex"),
"tree-sitter": Label("@vendor_py__tree-sitter-0.24.7//:tree_sitter"),
"tree-sitter-graph": Label("@vendor_py__tree-sitter-graph-0.12.0//:tree_sitter_graph"),
"tree-sitter": Label("@vendor_py__tree-sitter-0.20.10//:tree_sitter"),
"tree-sitter-graph": Label("@vendor_py__tree-sitter-graph-0.7.0//:tree_sitter_graph"),
},
},
"python/extractor/tsg-python/tsp": {
_COMMON_CONDITION: {
"tree-sitter": Label("@vendor_py__tree-sitter-0.24.7//:tree_sitter"),
"tree-sitter": Label("@vendor_py__tree-sitter-0.20.10//:tree_sitter"),
},
},
}
@@ -452,6 +452,16 @@ def crate_repositories():
Returns:
A list of repos visible to the module through the module extension.
"""
maybe(
http_archive,
name = "vendor_py__ahash-0.4.8",
sha256 = "0453232ace82dee0dd0b4c87a59bd90f7b53b314f3e0f61fe2ee7c8a16482289",
type = "tar.gz",
urls = ["https://static.crates.io/crates/ahash/0.4.8/download"],
strip_prefix = "ahash-0.4.8",
build_file = Label("//misc/bazel/3rdparty/py_deps:BUILD.ahash-0.4.8.bazel"),
)
maybe(
http_archive,
name = "vendor_py__aho-corasick-1.1.3",
@@ -532,6 +542,16 @@ def crate_repositories():
build_file = Label("//misc/bazel/3rdparty/py_deps:BUILD.cc-1.2.14.bazel"),
)
maybe(
http_archive,
name = "vendor_py__cfg-if-1.0.0",
sha256 = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd",
type = "tar.gz",
urls = ["https://static.crates.io/crates/cfg-if/1.0.0/download"],
strip_prefix = "cfg-if-1.0.0",
build_file = Label("//misc/bazel/3rdparty/py_deps:BUILD.cfg-if-1.0.0.bazel"),
)
maybe(
http_archive,
name = "vendor_py__clap-4.5.29",
@@ -572,6 +592,16 @@ def crate_repositories():
build_file = Label("//misc/bazel/3rdparty/py_deps:BUILD.colorchoice-1.0.3.bazel"),
)
maybe(
http_archive,
name = "vendor_py__hashbrown-0.9.1",
sha256 = "d7afe4a420e3fe79967a00898cc1f4db7c8a49a9333a29f8a4bd76a253d5cd04",
type = "tar.gz",
urls = ["https://static.crates.io/crates/hashbrown/0.9.1/download"],
strip_prefix = "hashbrown-0.9.1",
build_file = Label("//misc/bazel/3rdparty/py_deps:BUILD.hashbrown-0.9.1.bazel"),
)
maybe(
http_archive,
name = "vendor_py__is_terminal_polyfill-1.70.1",
@@ -734,12 +764,12 @@ def crate_repositories():
maybe(
http_archive,
name = "vendor_py__streaming-iterator-0.1.9",
sha256 = "2b2231b7c3057d5e4ad0156fb3dc807d900806020c5ffa3ee6ff2c8c76fb8520",
name = "vendor_py__string-interner-0.12.2",
sha256 = "383196d1876517ee6f9f0864d1fc1070331b803335d3c6daaa04bbcccd823c08",
type = "tar.gz",
urls = ["https://static.crates.io/crates/streaming-iterator/0.1.9/download"],
strip_prefix = "streaming-iterator-0.1.9",
build_file = Label("//misc/bazel/3rdparty/py_deps:BUILD.streaming-iterator-0.1.9.bazel"),
urls = ["https://static.crates.io/crates/string-interner/0.12.2/download"],
strip_prefix = "string-interner-0.12.2",
build_file = Label("//misc/bazel/3rdparty/py_deps:BUILD.string-interner-0.12.2.bazel"),
)
maybe(
@@ -784,32 +814,22 @@ def crate_repositories():
maybe(
http_archive,
name = "vendor_py__tree-sitter-0.24.7",
sha256 = "a5387dffa7ffc7d2dae12b50c6f7aab8ff79d6210147c6613561fc3d474c6f75",
name = "vendor_py__tree-sitter-0.20.10",
sha256 = "e747b1f9b7b931ed39a548c1fae149101497de3c1fc8d9e18c62c1a66c683d3d",
type = "tar.gz",
urls = ["https://static.crates.io/crates/tree-sitter/0.24.7/download"],
strip_prefix = "tree-sitter-0.24.7",
build_file = Label("//misc/bazel/3rdparty/py_deps:BUILD.tree-sitter-0.24.7.bazel"),
urls = ["https://static.crates.io/crates/tree-sitter/0.20.10/download"],
strip_prefix = "tree-sitter-0.20.10",
build_file = Label("//misc/bazel/3rdparty/py_deps:BUILD.tree-sitter-0.20.10.bazel"),
)
maybe(
http_archive,
name = "vendor_py__tree-sitter-graph-0.12.0",
sha256 = "63f86eb73c7d891c4b9b6fe4d4e63dd94c506e4788af7c2296afdcfbeea626cc",
name = "vendor_py__tree-sitter-graph-0.7.0",
sha256 = "639d21e886f581d293de5f5081f09af003c54607ff3fa85efa159b243ba1f97a",
type = "tar.gz",
urls = ["https://static.crates.io/crates/tree-sitter-graph/0.12.0/download"],
strip_prefix = "tree-sitter-graph-0.12.0",
build_file = Label("//misc/bazel/3rdparty/py_deps:BUILD.tree-sitter-graph-0.12.0.bazel"),
)
maybe(
http_archive,
name = "vendor_py__tree-sitter-language-0.1.4",
sha256 = "38eee4db33814de3d004de9d8d825627ed3320d0989cce0dea30efaf5be4736c",
type = "tar.gz",
urls = ["https://static.crates.io/crates/tree-sitter-language/0.1.4/download"],
strip_prefix = "tree-sitter-language-0.1.4",
build_file = Label("//misc/bazel/3rdparty/py_deps:BUILD.tree-sitter-language-0.1.4.bazel"),
urls = ["https://static.crates.io/crates/tree-sitter-graph/0.7.0/download"],
strip_prefix = "tree-sitter-graph-0.7.0",
build_file = Label("//misc/bazel/3rdparty/py_deps:BUILD.tree-sitter-graph-0.7.0.bazel"),
)
maybe(
@@ -937,6 +957,6 @@ def crate_repositories():
struct(repo = "vendor_py__cc-1.2.14", is_dev_dep = False),
struct(repo = "vendor_py__clap-4.5.29", is_dev_dep = False),
struct(repo = "vendor_py__regex-1.11.1", is_dev_dep = False),
struct(repo = "vendor_py__tree-sitter-0.24.7", is_dev_dep = False),
struct(repo = "vendor_py__tree-sitter-graph-0.12.0", is_dev_dep = False),
struct(repo = "vendor_py__tree-sitter-0.20.10", is_dev_dep = False),
struct(repo = "vendor_py__tree-sitter-graph-0.7.0", is_dev_dep = False),
]

View File

@@ -2,6 +2,12 @@
# It is not intended for manual editing.
version = 3
[[package]]
name = "ahash"
version = "0.4.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0453232ace82dee0dd0b4c87a59bd90f7b53b314f3e0f61fe2ee7c8a16482289"
[[package]]
name = "aho-corasick"
version = "1.1.3"
@@ -76,6 +82,12 @@ dependencies = [
"shlex",
]
[[package]]
name = "cfg-if"
version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
[[package]]
name = "clap"
version = "4.5.29"
@@ -109,6 +121,15 @@ version = "1.0.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5b63caa9aa9397e2d9480a9b13673856c78d8ac123288526c37d7839f2a86990"
[[package]]
name = "hashbrown"
version = "0.9.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d7afe4a420e3fe79967a00898cc1f4db7c8a49a9333a29f8a4bd76a253d5cd04"
dependencies = [
"ahash",
]
[[package]]
name = "is_terminal_polyfill"
version = "1.70.1"
@@ -237,10 +258,14 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7fcf8323ef1faaee30a44a340193b1ac6814fd9b7b4e88e9d4519a3e4abe1cfd"
[[package]]
name = "streaming-iterator"
version = "0.1.9"
name = "string-interner"
version = "0.12.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2b2231b7c3057d5e4ad0156fb3dc807d900806020c5ffa3ee6ff2c8c76fb8520"
checksum = "383196d1876517ee6f9f0864d1fc1070331b803335d3c6daaa04bbcccd823c08"
dependencies = [
"cfg-if",
"hashbrown",
]
[[package]]
name = "strsim"
@@ -281,39 +306,30 @@ dependencies = [
[[package]]
name = "tree-sitter"
version = "0.24.7"
version = "0.20.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a5387dffa7ffc7d2dae12b50c6f7aab8ff79d6210147c6613561fc3d474c6f75"
checksum = "e747b1f9b7b931ed39a548c1fae149101497de3c1fc8d9e18c62c1a66c683d3d"
dependencies = [
"cc",
"regex",
"regex-syntax",
"streaming-iterator",
"tree-sitter-language",
]
[[package]]
name = "tree-sitter-graph"
version = "0.12.0"
version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "63f86eb73c7d891c4b9b6fe4d4e63dd94c506e4788af7c2296afdcfbeea626cc"
checksum = "639d21e886f581d293de5f5081f09af003c54607ff3fa85efa159b243ba1f97a"
dependencies = [
"log",
"regex",
"serde",
"serde_json",
"smallvec",
"streaming-iterator",
"string-interner",
"thiserror",
"tree-sitter",
]
[[package]]
name = "tree-sitter-language"
version = "0.1.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "38eee4db33814de3d004de9d8d825627ed3320d0989cce0dea30efaf5be4736c"
[[package]]
name = "tsg-python"
version = "0.1.0"

View File

@@ -10,7 +10,7 @@ edition = "2021"
[dependencies]
anyhow = "1.0"
regex = "1"
tree-sitter = "^0.24"
tree-sitter-graph = "0.12.0"
tree-sitter = "0.20.4"
tree-sitter-graph = "0.7.0"
tsp = {path = "tsp"}
clap = "4.5"

View File

@@ -2,6 +2,6 @@
# extractor. It is set to the lowest version of Rust we want to support.
[toolchain]
channel = "1.82"
channel = "1.74"
profile = "minimal"
components = [ "rustfmt" ]

View File

@@ -10,6 +10,7 @@ use std::path::Path;
use anyhow::anyhow;
use anyhow::Context as _;
use anyhow::Result;
use clap::{Command, Arg, ArgAction};
use tree_sitter::Parser;
use tree_sitter_graph::ast::File;
use tree_sitter_graph::functions::Functions;
@@ -480,14 +481,18 @@ pub mod extra_functions {
}
fn main() -> Result<()> {
let matches = clap::Command::new("tsg-python")
let matches = Command::new("tsg-python")
.version(BUILD_VERSION)
.author("Taus Brock-Nannestad <tausbn@github.com>")
.about("Extracts a Python AST from the parse tree given by tree-sitter-python")
.args(&[
clap::arg!("-t --tsg [TSG]"),
clap::arg!("--source <SOURCE>"),
])
.arg(
Arg::new("tsg")
.short('t')
.long("tsg")
.action(ArgAction::Set)
.required(false)
)
.arg(Arg::new("source").index(1).required(true))
.get_matches();
let tsg_path = matches
@@ -497,7 +502,7 @@ fn main() -> Result<()> {
let source_path = Path::new(matches.get_one::<String>("source").unwrap());
let language = tsp::language();
let mut parser = Parser::new();
parser.set_language(&language)?;
parser.set_language(language)?;
// Statically include `python.tsg`:
let tsg = if matches.contains_id("tsg") {
std::fs::read(&tsg_path).with_context(|| format!("Error reading TSG file {}", tsg_path))?

View File

@@ -26,7 +26,7 @@ path = "bindings/rust/lib.rs"
## When updating these dependencies, run `misc/bazel/3rdparty/update_cargo_deps.sh`
[dependencies]
tree-sitter = "^0.24"
tree-sitter = ">= 0.20, < 0.21"
[build-dependencies]
cc = "1.2"