Rename Query::step_is_definite -> is_pattern_guaranteed_at_step

This commit is contained in:
Max Brunsfeld 2021-11-21 11:37:52 -08:00
parent f69c4861c3
commit 142f4b6438
5 changed files with 9 additions and 7 deletions

View file

@ -3786,7 +3786,7 @@ fn test_query_is_pattern_guaranteed_at_step() {
for (substring, is_definite) in row.results_by_substring {
let offset = row.pattern.find(substring).unwrap();
assert_eq!(
query.step_is_definite(offset),
query.is_pattern_guaranteed_at_step(offset),
*is_definite,
"Description: {}, Pattern: {:?}, substring: {:?}, expected is_definite to be {}",
row.description,

View file

@ -1,4 +1,4 @@
/* automatically generated by rust-bindgen 0.58.1 */
/* automatically generated by rust-bindgen 0.59.1 */
pub type __darwin_size_t = ::std::os::raw::c_ulong;
pub type FILE = [u64; 19usize];
@ -659,7 +659,7 @@ extern "C" {
) -> *const TSQueryPredicateStep;
}
extern "C" {
pub fn ts_query_step_is_definite(self_: *const TSQuery, byte_offset: u32) -> bool;
pub fn ts_query_is_pattern_guaranteed_at_step(self_: *const TSQuery, byte_offset: u32) -> bool;
}
extern "C" {
#[doc = " Get the name and length of one of the query's captures, or one of the"]

View file

@ -1586,8 +1586,10 @@ impl Query {
///
/// A query step is 'definite' if its parent pattern will be guaranteed to match
/// successfully once it reaches the step.
pub fn step_is_definite(&self, byte_offset: usize) -> bool {
unsafe { ffi::ts_query_step_is_definite(self.ptr.as_ptr(), byte_offset as u32) }
pub fn is_pattern_guaranteed_at_step(&self, byte_offset: usize) -> bool {
unsafe {
ffi::ts_query_is_pattern_guaranteed_at_step(self.ptr.as_ptr(), byte_offset as u32)
}
}
fn parse_property(

View file

@ -725,7 +725,7 @@ const TSQueryPredicateStep *ts_query_predicates_for_pattern(
uint32_t *length
);
bool ts_query_step_is_definite(
bool ts_query_is_pattern_guaranteed_at_step(
const TSQuery *self,
uint32_t byte_offset
);

View file

@ -2269,7 +2269,7 @@ uint32_t ts_query_start_byte_for_pattern(
return self->patterns.contents[pattern_index].start_byte;
}
bool ts_query_step_is_definite(
bool ts_query_is_pattern_guaranteed_at_step(
const TSQuery *self,
uint32_t byte_offset
) {