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

@ -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