Compare commits

..

2 Commits

Author SHA1 Message Date
d62b1657c3 Try to load language for --do-you-understand 2023-11-12 11:42:22 +01:00
169380d8bc Update tree-sitter 2023-11-12 11:41:49 +01:00
3 changed files with 13 additions and 24 deletions

24
Cargo.lock generated
View File

@ -448,12 +448,6 @@ version = "1.0.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7ffc183a10b4478d04cbbbfc96d0873219d962dd5accaff2ffbd4ceb7df837f4"
[[package]]
name = "ryu"
version = "1.0.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1ad4cc8da4ef723ed60bced201181d83791ad433213d8c24efffda1eec85d741"
[[package]]
name = "serde"
version = "1.0.192"
@ -474,17 +468,6 @@ dependencies = [
"syn 2.0.39",
]
[[package]]
name = "serde_json"
version = "1.0.108"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3d1c7e3eac408d115102c4c24ad393e0821bb3a5df4d506a80f85f7a742a526b"
dependencies = [
"itoa",
"ryu",
"serde",
]
[[package]]
name = "slog"
version = "2.7.0"
@ -724,15 +707,12 @@ dependencies = [
[[package]]
name = "tree-sitter"
version = "0.6.3"
version = "0.20.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "376e181cb69da67bad2d69806cf2500656fd68123c526a61e5cbbfc65110c5b0"
checksum = "e747b1f9b7b931ed39a548c1fae149101497de3c1fc8d9e18c62c1a66c683d3d"
dependencies = [
"cc",
"regex",
"serde",
"serde_derive",
"serde_json",
]
[[package]]

View File

@ -12,7 +12,7 @@ slog = { version = "2.5.2", features = ["release_max_level_debug"] }
slog-scope = "4.3.0"
sloggers = "0.3.5"
toml = "0.5.6"
tree-sitter = "0.6.0"
tree-sitter = "0.20.10"
# [profile.release]
# lto = true

View File

@ -37,7 +37,16 @@ fn main() {
if let Some(filetype) = matches.value_of("do-you-understand") {
let language = ffi::filetype_to_language(filetype);
std::process::exit(if language.is_some() { 0 } else { 1 });
if let Some(language) = language {
eprintln!("Known language. Trying to load");
let mut parser = Parser::new();
parser.set_language(language).unwrap();
eprintln!("Loaded successfully");
std::process::exit(0);
} else {
eprintln!("Unknown language");
std::process::exit(1);
}
}
let config = if let Some(config_path) = matches.value_of("config") {