mirror of
https://github.com/github/codeql.git
synced 2026-02-19 08:23:45 +01:00
Use tree_sitter_ruby crate in generator
This commit is contained in:
1
Cargo.lock
generated
1
Cargo.lock
generated
@@ -103,6 +103,7 @@ dependencies = [
|
||||
"node-types",
|
||||
"tracing",
|
||||
"tracing-subscriber",
|
||||
"tree-sitter-ruby",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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,
|
||||
}
|
||||
|
||||
@@ -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) => {
|
||||
|
||||
Reference in New Issue
Block a user