diff --git a/cli/src/generate/mod.rs b/cli/src/generate/mod.rs index 582f9aca..cc92e56d 100644 --- a/cli/src/generate/mod.rs +++ b/cli/src/generate/mod.rs @@ -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(()) } diff --git a/cli/src/main.rs b/cli/src/main.rs index 1cf90c67..791bd188 100644 --- a/cli/src/main.rs +++ b/cli/src/main.rs @@ -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( ¤t_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. diff --git a/script/generate-fixtures b/script/generate-fixtures index e06af1f7..135c4d71 100755 --- a/script/generate-fixtures +++ b/script/generate-fixtures @@ -22,6 +22,6 @@ while read -r grammar_file; do echo "Regenerating ${grammar_name} parser" ( cd $grammar_dir - "$tree_sitter" generate src/grammar.json + "$tree_sitter" generate src/grammar.json --no-bindings ) done <<< "$grammar_files" diff --git a/script/generate-fixtures.cmd b/script/generate-fixtures.cmd index f0003c50..227029b6 100644 --- a/script/generate-fixtures.cmd +++ b/script/generate-fixtures.cmd @@ -6,7 +6,7 @@ set tree_sitter="%cd%\target\release\tree-sitter" for /f "tokens=*" %%f in ('dir test\fixtures\grammars\grammar.js /b/s') do ( pushd "%%f\.." echo Regenerating parser !cd! - %tree_sitter% generate src\grammar.json + %tree_sitter% generate src\grammar.json --no-bindings popd )