From abd57bc69b4ec9af9d4e5f76c2f4f63273a35444 Mon Sep 17 00:00:00 2001 From: Andrew Hlynskyi Date: Sun, 20 Aug 2023 16:10:13 +0300 Subject: [PATCH] chore: simplify script/generate-bindings --- lib/binding_rust/bindings.rs | 5 ++--- script/generate-bindings | 13 +------------ 2 files changed, 3 insertions(+), 15 deletions(-) diff --git a/lib/binding_rust/bindings.rs b/lib/binding_rust/bindings.rs index e7168fb5..225fbc11 100644 --- a/lib/binding_rust/bindings.rs +++ b/lib/binding_rust/bindings.rs @@ -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, ); } - -pub const TREE_SITTER_LANGUAGE_VERSION: usize = 14; -pub const TREE_SITTER_MIN_COMPATIBLE_LANGUAGE_VERSION: usize = 13; diff --git a/script/generate-bindings b/script/generate-bindings index fb47e247..52fc43f3 100755 --- a/script/generate-bindings +++ b/script/generate-bindings @@ -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