Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'helix-syntax/src/tree_sitter/query_captures.rs')
| -rw-r--r-- | helix-syntax/src/tree_sitter/query_captures.rs | 66 |
1 files changed, 0 insertions, 66 deletions
diff --git a/helix-syntax/src/tree_sitter/query_captures.rs b/helix-syntax/src/tree_sitter/query_captures.rs deleted file mode 100644 index 41a2c093..00000000 --- a/helix-syntax/src/tree_sitter/query_captures.rs +++ /dev/null @@ -1,66 +0,0 @@ -use std::ptr::{self, NonNull}; - -use regex_cursor::Cursor; - -use crate::tree_sitter::query::Query; -use crate::tree_sitter::syntax_tree_node::SyntaxTreeNodeRaw; - -enum QueryCursorData {} - -pub struct QueryCaptures<'a> { - query: &'a Query, - query_cursor: &'a mut QueryCursorData, - text_cursor: regex_cursor::RopeyCursor<'a>, -} - -impl<C: Cursor> QueryCaptures<'_, C> { - fn next(&mut self) { - let mut query_match = TSQueryMatch { - id: 0, - pattern_index: 0, - capture_count: 0, - captures: ptr::null(), - }; - let mut capture_idx = 0; - loop { - let success = unsafe { - ts_query_cursor_next_capture( - &mut self.query_cursor, - &mut query_match, - &mut capture_idx, - ) - }; - if !success { - break; - } - } - let mut input = regex_cursor::Input::new(self.text_cursor.clone()); - } -} - -#[repr(C)] -#[derive(Debug)] -struct TSQueryCapture { - node: SyntaxTreeNodeRaw, - index: u32, -} - -#[repr(C)] -#[derive(Debug)] -struct TSQueryMatch { - id: u32, - pattern_index: u16, - capture_count: u16, - captures: *const TSQueryCapture, -} - -extern "C" { - /// Advance to the next capture of the currently running query. - /// If there is a capture, write its match to `*match` and its index within - /// the matche's capture list to `*capture_index`. Otherwise, return `false`. - fn ts_query_cursor_next_capture( - self_: &mut QueryCursorData, - match_: &mut TSQueryMatch, - capture_index: &mut u32, - ) -> bool; -} |