Add ts_query_disable_capture API

This commit is contained in:
Max Brunsfeld 2019-09-26 15:58:41 -07:00
parent 4c17af3ecd
commit f490befcde
4 changed files with 46 additions and 2 deletions

View file

@ -655,6 +655,16 @@ extern "C" {
length: *mut u32,
) -> *const ::std::os::raw::c_char;
}
extern "C" {
#[doc = " Disable a certain capture within a query. This prevents the capture"]
#[doc = " from being returned in matches, and also avoids any resource usage"]
#[doc = " associated with recording the capture."]
pub fn ts_query_disable_capture(
arg1: *mut TSQuery,
arg2: *const ::std::os::raw::c_char,
arg3: u32,
);
}
extern "C" {
#[doc = " Create a new cursor for executing a given query."]
#[doc = ""]

View file

@ -1202,6 +1202,16 @@ impl Query {
&self.property_settings[index]
}
pub fn disable_capture(&mut self, name: &str) {
unsafe {
ffi::ts_query_disable_capture(
self.ptr.as_ptr(),
name.as_bytes().as_ptr() as *const c_char,
name.len() as u32,
);
}
}
fn parse_property(
function_name: &str,
capture_names: &[String],