#!/bin/bash output_path=lib/binding_rust/bindings.rs header_path='lib/include/tree_sitter/api.h' bindgen \ --no-layout-tests \ --allowlist-type '^TS.*' \ --allowlist-function '^ts_.*' \ --blocklist-type '^__.*' \ --size_t-is-usize \ $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=$(egrep "#define $define (.*)" $header_path | cut -d' ' -f3) echo "pub const $define: usize = $define_value;" >> $output_path done