Use tree_sitter_ruby crate in generator

This commit is contained in:
Nick Rolfe
2020-10-27 18:13:40 +00:00
parent 2663de86fb
commit 5484ff3dcf
4 changed files with 7 additions and 5 deletions

1
Cargo.lock generated
View File

@@ -103,6 +103,7 @@ dependencies = [
"node-types",
"tracing",
"tracing-subscriber",
"tree-sitter-ruby",
]
[[package]]

View File

@@ -10,3 +10,4 @@ edition = "2018"
node-types = { path = "../node-types" }
tracing = "0.1"
tracing-subscriber = { version = "0.2", features = ["env-filter"] }
tree-sitter-ruby = "0.16"

View File

@@ -1,7 +1,7 @@
use std::path::PathBuf;
pub struct Language {
pub struct Language<'a> {
pub name: String,
pub node_types_path: PathBuf,
pub node_types: &'a str,
pub dbscheme_path: PathBuf,
}

View File

@@ -288,12 +288,12 @@ fn main() {
// command line.
let ruby = Language {
name: "Ruby".to_string(),
node_types_path: PathBuf::from("tree-sitter-ruby/src/node-types.json"),
node_types: tree_sitter_ruby::NODE_TYPES,
dbscheme_path: PathBuf::from("ruby.dbscheme"),
};
match node_types::read_node_types(&ruby.node_types_path) {
match node_types::read_node_types_str(&ruby.node_types) {
Err(e) => {
error!("Failed to read '{}': {}", ruby.node_types_path.display(), e);
error!("Failed to read node-types JSON for {}: {}", ruby.name, e);
std::process::exit(1);
}
Ok(nodes) => {