diff --git a/Cargo.lock b/Cargo.lock index f3d81b070f0..dcee32f598f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -103,6 +103,7 @@ dependencies = [ "node-types", "tracing", "tracing-subscriber", + "tree-sitter-ruby", ] [[package]] diff --git a/generator/Cargo.toml b/generator/Cargo.toml index a7587f73497..32ef3ac4a03 100644 --- a/generator/Cargo.toml +++ b/generator/Cargo.toml @@ -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" diff --git a/generator/src/language.rs b/generator/src/language.rs index 7f289c27de2..c3f9b282e3e 100644 --- a/generator/src/language.rs +++ b/generator/src/language.rs @@ -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, } diff --git a/generator/src/main.rs b/generator/src/main.rs index 4deb7646d7f..3861a6cd665 100644 --- a/generator/src/main.rs +++ b/generator/src/main.rs @@ -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) => {