Merge branch 'master' into wasm-language

This commit is contained in:
Max Brunsfeld 2023-10-27 11:57:04 +01:00
commit f4e2f68f14
161 changed files with 10293 additions and 4253 deletions

View file

@ -2,14 +2,41 @@
output_path=lib/binding_rust/bindings.rs
header_path='lib/include/tree_sitter/api.h'
no_derive_copy=(
TSInput
TSLanguage
TSLogger
TSLookaheadIterator
TSParser
TSTree
TSQuery
TSQueryCursor
TSQueryCapture
TSQueryMatch
TSQueryPredicateStep
)
no_copy=$(IFS='|'; echo "${no_derive_copy[*]}")
file_version=$(head -n1 "$output_path" | cut -d' ' -f6)
tool_version=$(bindgen --version | cut -d' ' -f2)
higher_version=$(echo -e "${file_version}\n${tool_version}" | sort -V | tail -n1)
if [ "$higher_version" != "$tool_version" ]; then
echo "Latest used bindgen version was $file_version" >&2
echo "Currently installed bindgen CLI version is $tool_version" >&2
echo >&2
echo "It's needed to upgrade bindgen CLI first with \`cargo install bindgen-cli\`" >&2
exit 1
fi
bindgen \
--no-layout-tests \
--whitelist-type '^TS.*' \
--whitelist-function '^ts_.*' \
--opaque-type FILE \
--blocklist-type FILE \
--allowlist-type '^TS.*' \
--allowlist-function '^ts_.*' \
--allowlist-var "^TREE_SITTER.*" \
--blocklist-type '^__.*' \
--no-prepend-enum-name \
--no-copy "$no_copy" \
--blocklist-function ts_tree_print_dot_graph \
--size_t-is-usize \
$header_path \