Add --no-bindings flag to generate subcommand

This commit is contained in:
Max Brunsfeld 2021-03-08 12:01:45 -08:00
parent 841e160898
commit 8e894ff3f1
4 changed files with 19 additions and 6 deletions

View file

@ -41,6 +41,7 @@ pub fn generate_parser_in_directory(
repo_path: &PathBuf,
grammar_path: Option<&str>,
next_abi: bool,
generate_bindings: bool,
report_symbol_name: Option<&str>,
) -> Result<()> {
let src_path = repo_path.join("src");
@ -90,7 +91,9 @@ pub fn generate_parser_in_directory(
write_file(&header_path.join("parser.h"), tree_sitter::PARSER_HEADER)?;
}
binding_files::generate_binding_files(&repo_path, &language_name)?;
if generate_bindings {
binding_files::generate_binding_files(&repo_path, &language_name)?;
}
Ok(())
}

View file

@ -42,6 +42,7 @@ fn run() -> error::Result<()> {
.arg(Arg::with_name("grammar-path").index(1))
.arg(Arg::with_name("log").long("log"))
.arg(Arg::with_name("prev-abi").long("prev-abi"))
.arg(Arg::with_name("no-bindings").long("no-bindings"))
.arg(
Arg::with_name("report-states-for-rule")
.long("report-states-for-rule")
@ -185,11 +186,13 @@ fn run() -> error::Result<()> {
if matches.is_present("log") {
logger::init();
}
let prev_abi = matches.is_present("prev-abi");
let new_abi = !matches.is_present("prev-abi");
let generate_bindings = !matches.is_present("no-bindings");
generate::generate_parser_in_directory(
&current_dir,
grammar_path,
!prev_abi,
new_abi,
generate_bindings,
report_symbol_name,
)?;
} else if let Some(matches) = matches.subcommand_matches("test") {
@ -209,7 +212,14 @@ fn run() -> error::Result<()> {
test_corpus_dir = current_dir.join("corpus");
}
if test_corpus_dir.is_dir() {
test::run_tests_at_path(*language, &test_corpus_dir, debug, debug_graph, filter, update)?;
test::run_tests_at_path(
*language,
&test_corpus_dir,
debug,
debug_graph,
filter,
update,
)?;
}
// Check that all of the queries are valid.