Add --no-bindings flag to generate subcommand
This commit is contained in:
parent
841e160898
commit
8e894ff3f1
4 changed files with 19 additions and 6 deletions
|
|
@ -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(())
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
|
|
|
|||
|
|
@ -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
|
||||
)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue