Provide ::set_{byte,point}_range on both query iterators
This commit is contained in:
parent
97dfee6325
commit
7f4eb9a222
1 changed files with 28 additions and 13 deletions
|
|
@ -198,11 +198,6 @@ pub enum QueryErrorKind {
|
||||||
Structure,
|
Structure,
|
||||||
}
|
}
|
||||||
|
|
||||||
trait TextCallback<'a> {
|
|
||||||
fn call(&mut self, node: Node);
|
|
||||||
fn next_chunk(&mut self) -> Option<&'a [u8]>;
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
enum TextPredicate {
|
enum TextPredicate {
|
||||||
CaptureEqString(u32, String, bool),
|
CaptureEqString(u32, String, bool),
|
||||||
|
|
@ -1836,14 +1831,6 @@ impl<'a, 'tree, T: TextProvider<'a>> Iterator for QueryMatches<'a, 'tree, T> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, 'tree, T: TextProvider<'a>> QueryCaptures<'a, 'tree, T> {
|
|
||||||
pub fn set_byte_range(&mut self, start: usize, end: usize) {
|
|
||||||
unsafe {
|
|
||||||
ffi::ts_query_cursor_set_byte_range(self.ptr, start as u32, end as u32);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<'a, 'tree, T: TextProvider<'a>> Iterator for QueryCaptures<'a, 'tree, T> {
|
impl<'a, 'tree, T: TextProvider<'a>> Iterator for QueryCaptures<'a, 'tree, T> {
|
||||||
type Item = (QueryMatch<'a, 'tree>, usize);
|
type Item = (QueryMatch<'a, 'tree>, usize);
|
||||||
|
|
||||||
|
|
@ -1876,6 +1863,34 @@ impl<'a, 'tree, T: TextProvider<'a>> Iterator for QueryCaptures<'a, 'tree, T> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl<'a, 'tree, T: TextProvider<'a>> QueryMatches<'a, 'tree, T> {
|
||||||
|
pub fn set_byte_range(&mut self, start: usize, end: usize) {
|
||||||
|
unsafe {
|
||||||
|
ffi::ts_query_cursor_set_byte_range(self.ptr, start as u32, end as u32);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn set_point_range(&mut self, start: Point, end: Point) {
|
||||||
|
unsafe {
|
||||||
|
ffi::ts_query_cursor_set_point_range(self.ptr, start.into(), end.into());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl<'a, 'tree, T: TextProvider<'a>> QueryCaptures<'a, 'tree, T> {
|
||||||
|
pub fn set_byte_range(&mut self, start: usize, end: usize) {
|
||||||
|
unsafe {
|
||||||
|
ffi::ts_query_cursor_set_byte_range(self.ptr, start as u32, end as u32);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn set_point_range(&mut self, start: Point, end: Point) {
|
||||||
|
unsafe {
|
||||||
|
ffi::ts_query_cursor_set_point_range(self.ptr, start.into(), end.into());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl<'cursor, 'tree> fmt::Debug for QueryMatch<'cursor, 'tree> {
|
impl<'cursor, 'tree> fmt::Debug for QueryMatch<'cursor, 'tree> {
|
||||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||||
write!(
|
write!(
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue