Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'helix-syntax/src/tree_sitter/query.rs')
-rw-r--r--helix-syntax/src/tree_sitter/query.rs20
1 files changed, 20 insertions, 0 deletions
diff --git a/helix-syntax/src/tree_sitter/query.rs b/helix-syntax/src/tree_sitter/query.rs
index 26ae045e..514b8990 100644
--- a/helix-syntax/src/tree_sitter/query.rs
+++ b/helix-syntax/src/tree_sitter/query.rs
@@ -4,6 +4,8 @@ use std::path::{Path, PathBuf};
use std::ptr::NonNull;
use std::{slice, str};
+use regex_cursor::Cursor;
+
use crate::tree_sitter::query::predicate::{InvalidPredicateError, Predicate, TextPredicate};
use crate::tree_sitter::query::property::QueryProperty;
use crate::tree_sitter::Grammar;
@@ -155,6 +157,24 @@ impl Query {
Ok(query)
}
+ pub fn satsifies_text_predicate<C: Cursor>(
+ &self,
+ cursor: &mut regex_cursor::Input<C>,
+ pattern: u32,
+ ) {
+ let text_predicates = self.patterns[pattern as usize].text_predicates;
+ let text_predicates =
+ &self.text_predicates[text_predicates.start as usize..text_predicates.end as usize];
+ for predicate in text_predicates {
+ match predicate.kind {
+ predicate::TextPredicateKind::EqString(_) => todo!(),
+ predicate::TextPredicateKind::EqCapture(_) => todo!(),
+ predicate::TextPredicateKind::MatchString(_) => todo!(),
+ predicate::TextPredicateKind::AnyString(_) => todo!(),
+ }
+ }
+ }
+
// fn parse_predicates(&mut self) {
// let pattern_count = unsafe { ts_query_pattern_count(self.raw) };