Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 5484ff3

Browse files
committed
Use tree_sitter_ruby crate in generator
1 parent 2663de8 commit 5484ff3

4 files changed

Lines changed: 7 additions & 5 deletions

File tree

Cargo.lock

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

generator/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,4 @@ edition = "2018"
1010
node-types = { path = "../node-types" }
1111
tracing = "0.1"
1212
tracing-subscriber = { version = "0.2", features = ["env-filter"] }
13+
tree-sitter-ruby = "0.16"

generator/src/language.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use std::path::PathBuf;
22

3-
pub struct Language {
3+
pub struct Language<'a> {
44
pub name: String,
5-
pub node_types_path: PathBuf,
5+
pub node_types: &'a str,
66
pub dbscheme_path: PathBuf,
77
}

generator/src/main.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -288,12 +288,12 @@ fn main() {
288288
// command line.
289289
let ruby = Language {
290290
name: "Ruby".to_string(),
291-
node_types_path: PathBuf::from("tree-sitter-ruby/src/node-types.json"),
291+
node_types: tree_sitter_ruby::NODE_TYPES,
292292
dbscheme_path: PathBuf::from("ruby.dbscheme"),
293293
};
294-
match node_types::read_node_types(&ruby.node_types_path) {
294+
match node_types::read_node_types_str(&ruby.node_types) {
295295
Err(e) => {
296-
error!("Failed to read '{}': {}", ruby.node_types_path.display(), e);
296+
error!("Failed to read node-types JSON for {}: {}", ruby.name, e);
297297
std::process::exit(1);
298298
}
299299
Ok(nodes) => {

0 commit comments

Comments
 (0)