chore: simplify script/generate-bindings

This commit is contained in:
Andrew Hlynskyi 2023-08-20 16:10:13 +03:00
parent 4278e03b11
commit abd57bc69b
2 changed files with 3 additions and 15 deletions

View file

@ -1,5 +1,7 @@
/* automatically generated by rust-bindgen 0.66.1 */
pub const TREE_SITTER_LANGUAGE_VERSION: u32 = 14;
pub const TREE_SITTER_MIN_COMPATIBLE_LANGUAGE_VERSION: u32 = 13;
pub type TSStateId = u16;
pub type TSSymbol = u16;
pub type TSFieldId = u16;
@ -783,6 +785,3 @@ extern "C" {
new_free: ::std::option::Option<unsafe extern "C" fn(arg1: *mut ::std::os::raw::c_void)>,
);
}
pub const TREE_SITTER_LANGUAGE_VERSION: usize = 14;
pub const TREE_SITTER_MIN_COMPATIBLE_LANGUAGE_VERSION: usize = 13;

View file

@ -33,18 +33,7 @@ bindgen \
--no-layout-tests \
--allowlist-type '^TS.*' \
--allowlist-function '^ts_.*' \
--allowlist-var "^TREE_SITTER.*" \
--blocklist-type '^__.*' \
--no-copy "$no_copy" \
$header_path > $output_path
echo "" >> $output_path
defines=(
TREE_SITTER_LANGUAGE_VERSION
TREE_SITTER_MIN_COMPATIBLE_LANGUAGE_VERSION
)
for define in "${defines[@]}"; do
define_value=$(grep -E "#define $define (.*)" $header_path | cut -d' ' -f3)
echo "pub const $define: usize = $define_value;" >> $output_path
done