Simplify allocation-recording in test suite using new ts_set_allocator API

This commit is contained in:
Max Brunsfeld 2021-12-30 16:09:07 -08:00
parent e01ea9ff51
commit 622359b400
19 changed files with 245 additions and 254 deletions

View file

@ -1,4 +1,4 @@
/* automatically generated by rust-bindgen 0.59.1 */
/* automatically generated by rust-bindgen 0.59.2 */
pub type TSSymbol = u16;
pub type TSFieldId = u16;
@ -29,11 +29,11 @@ pub struct TSQueryCursor {
}
pub const TSInputEncoding_TSInputEncodingUTF8: TSInputEncoding = 0;
pub const TSInputEncoding_TSInputEncodingUTF16: TSInputEncoding = 1;
pub type TSInputEncoding = u32;
pub type TSInputEncoding = ::std::os::raw::c_uint;
pub const TSSymbolType_TSSymbolTypeRegular: TSSymbolType = 0;
pub const TSSymbolType_TSSymbolTypeAnonymous: TSSymbolType = 1;
pub const TSSymbolType_TSSymbolTypeAuxiliary: TSSymbolType = 2;
pub type TSSymbolType = u32;
pub type TSSymbolType = ::std::os::raw::c_uint;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct TSPoint {
@ -64,7 +64,7 @@ pub struct TSInput {
}
pub const TSLogType_TSLogTypeParse: TSLogType = 0;
pub const TSLogType_TSLogTypeLex: TSLogType = 1;
pub type TSLogType = u32;
pub type TSLogType = ::std::os::raw::c_uint;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct TSLogger {
@ -118,7 +118,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 = u32;
pub type TSQueryPredicateStepType = ::std::os::raw::c_uint;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct TSQueryPredicateStep {
@ -132,7 +132,7 @@ pub const TSQueryError_TSQueryErrorField: TSQueryError = 3;
pub const TSQueryError_TSQueryErrorCapture: TSQueryError = 4;
pub const TSQueryError_TSQueryErrorStructure: TSQueryError = 5;
pub const TSQueryError_TSQueryErrorLanguage: TSQueryError = 6;
pub type TSQueryError = u32;
pub type TSQueryError = ::std::os::raw::c_uint;
extern "C" {
#[doc = " Create a new parser."]
pub fn ts_parser_new() -> *mut TSParser;
@ -823,6 +823,37 @@ extern "C" {
#[doc = " See also `ts_parser_set_language`."]
pub fn ts_language_version(arg1: *const TSLanguage) -> u32;
}
extern "C" {
#[doc = " Set the allocation functions used by the library."]
#[doc = ""]
#[doc = " By default, Tree-sitter uses the standard libc allocation functions,"]
#[doc = " but aborts the process when an allocation fails. This function lets"]
#[doc = " you supply alternative allocation functions at runtime."]
#[doc = ""]
#[doc = " If you pass `NULL` for any parameter, Tree-sitter will switch back to"]
#[doc = " its default implementation of that function."]
#[doc = ""]
#[doc = " If you call this function after the library has already been used, then"]
#[doc = " you must ensure that either:"]
#[doc = " 1. All the existing objects have been freed."]
#[doc = " 2. The new allocator shares its state with the old one, so it is capable"]
#[doc = " of freeing memory that was allocated by the old allocator."]
pub fn ts_set_allocator(
new_malloc: ::std::option::Option<
unsafe extern "C" fn(arg1: usize) -> *mut ::std::os::raw::c_void,
>,
new_calloc: ::std::option::Option<
unsafe extern "C" fn(arg1: usize, arg2: usize) -> *mut ::std::os::raw::c_void,
>,
new_realloc: ::std::option::Option<
unsafe extern "C" fn(
arg1: *mut ::std::os::raw::c_void,
arg2: usize,
) -> *mut ::std::os::raw::c_void,
>,
new_free: ::std::option::Option<unsafe extern "C" fn(arg1: *mut ::std::os::raw::c_void)>,
);
}
pub const TREE_SITTER_LANGUAGE_VERSION: usize = 13;
pub const TREE_SITTER_MIN_COMPATIBLE_LANGUAGE_VERSION: usize = 13;