Query analysis: fix propagation of uncertainty from later siblings

This commit is contained in:
Max Brunsfeld 2020-06-26 16:31:08 -07:00
parent 645aacb1e7
commit cc37da7457
5 changed files with 99 additions and 67 deletions

View file

@ -654,6 +654,7 @@ extern "C" {
pub fn ts_query_pattern_is_definite(
self_: *const TSQuery,
pattern_index: u32,
symbol: TSSymbol,
step_index: u32,
) -> bool;
}

View file

@ -1467,9 +1467,9 @@ impl Query {
/// Check if a pattern will definitely match after a certain number of steps
/// have matched.
pub fn pattern_is_definite(&self, index: usize, step_index: usize) -> bool {
pub fn pattern_is_definite(&self, pattern_index: usize, symbol: u16, step_index: usize) -> bool {
unsafe {
ffi::ts_query_pattern_is_definite(self.ptr.as_ptr(), index as u32, step_index as u32)
ffi::ts_query_pattern_is_definite(self.ptr.as_ptr(), pattern_index as u32, symbol, step_index as u32)
}
}