diff --git a/lib/binding_rust/bindings.rs b/lib/binding_rust/bindings.rs index dccc9aca..22a6cea0 100644 --- a/lib/binding_rust/bindings.rs +++ b/lib/binding_rust/bindings.rs @@ -1,7 +1,6 @@ /* automatically generated by rust-bindgen 0.58.1 */ pub type __darwin_size_t = ::std::os::raw::c_ulong; -pub type size_t = usize; pub type FILE = [u64; 19usize]; pub type TSSymbol = u16; pub type TSFieldId = u16; @@ -32,11 +31,11 @@ pub struct TSQueryCursor { } pub const TSInputEncoding_TSInputEncodingUTF8: TSInputEncoding = 0; pub const TSInputEncoding_TSInputEncodingUTF16: TSInputEncoding = 1; -pub type TSInputEncoding = ::std::os::raw::c_uint; +pub type TSInputEncoding = u32; pub const TSSymbolType_TSSymbolTypeRegular: TSSymbolType = 0; pub const TSSymbolType_TSSymbolTypeAnonymous: TSSymbolType = 1; pub const TSSymbolType_TSSymbolTypeAuxiliary: TSSymbolType = 2; -pub type TSSymbolType = ::std::os::raw::c_uint; +pub type TSSymbolType = u32; #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct TSPoint { @@ -67,7 +66,7 @@ pub struct TSInput { } pub const TSLogType_TSLogTypeParse: TSLogType = 0; pub const TSLogType_TSLogTypeLex: TSLogType = 1; -pub type TSLogType = ::std::os::raw::c_uint; +pub type TSLogType = u32; #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct TSLogger { @@ -121,7 +120,7 @@ pub struct TSQueryMatch { pub const TSQueryPredicateStepType_TSQueryPredicateStepTypeDone: TSQueryPredicateStepType = 0; pub const TSQueryPredicateStepType_TSQueryPredicateStepTypeCapture: TSQueryPredicateStepType = 1; pub const TSQueryPredicateStepType_TSQueryPredicateStepTypeString: TSQueryPredicateStepType = 2; -pub type TSQueryPredicateStepType = ::std::os::raw::c_uint; +pub type TSQueryPredicateStepType = u32; #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct TSQueryPredicateStep { @@ -134,7 +133,7 @@ pub const TSQueryError_TSQueryErrorNodeType: TSQueryError = 2; pub const TSQueryError_TSQueryErrorField: TSQueryError = 3; pub const TSQueryError_TSQueryErrorCapture: TSQueryError = 4; pub const TSQueryError_TSQueryErrorStructure: TSQueryError = 5; -pub type TSQueryError = ::std::os::raw::c_uint; +pub type TSQueryError = u32; extern "C" { #[doc = " Create a new parser."] pub fn ts_parser_new() -> *mut TSParser; @@ -290,11 +289,11 @@ extern "C" { #[doc = " If a non-null pointer is assigned, then the parser will periodically read"] #[doc = " from this pointer during parsing. If it reads a non-zero value, it will"] #[doc = " halt early, returning NULL. See `ts_parser_parse` for more information."] - pub fn ts_parser_set_cancellation_flag(self_: *mut TSParser, flag: *const size_t); + pub fn ts_parser_set_cancellation_flag(self_: *mut TSParser, flag: *const usize); } extern "C" { #[doc = " Get the parser's current cancellation flag pointer."] - pub fn ts_parser_cancellation_flag(self_: *const TSParser) -> *const size_t; + pub fn ts_parser_cancellation_flag(self_: *const TSParser) -> *const usize; } extern "C" { #[doc = " Set the logger that a parser should use during parsing."] @@ -754,9 +753,6 @@ extern "C" { extern "C" { pub fn ts_query_cursor_remove_match(arg1: *mut TSQueryCursor, id: u32); } -extern "C" { - pub fn ts_query_cursor_advance_to_byte(arg1: *mut TSQueryCursor, offset: u32); -} extern "C" { #[doc = " Advance to the next capture of the currently running query."] #[doc = ""] diff --git a/script/generate-bindings b/script/generate-bindings index b1ac9640..19c79e96 100755 --- a/script/generate-bindings +++ b/script/generate-bindings @@ -3,12 +3,14 @@ output_path=lib/binding_rust/bindings.rs header_path='lib/include/tree_sitter/api.h' -bindgen \ - --no-layout-tests \ - --whitelist-type '^TS.*' \ - --whitelist-function '^ts_.*' \ - --opaque-type FILE \ - --distrust-clang-mangling \ +bindgen \ + --no-layout-tests \ + --whitelist-type '^TS.*' \ + --whitelist-function '^ts_.*' \ + --opaque-type FILE \ + --size_t-is-usize \ + --translate-enum-integer-types \ + --distrust-clang-mangling \ $header_path > $output_path echo "" >> $output_path