fork of https://github.com/tree-sitter/tree-sitter-graph

Add public method to visit matches

Changed files
+18
src
+18
src/execution.rs
··· 12 12 use tree_sitter::Tree; 13 13 14 14 use crate::ast::File; 15 + use crate::ast::Stanza; 15 16 use crate::execution::error::ExecutionError; 16 17 use crate::functions::Functions; 17 18 use crate::graph::Graph; ··· 93 94 } 94 95 95 96 Ok(()) 97 + } 98 + 99 + pub fn try_visit_matches<'a, 'tree, E, F>( 100 + &self, 101 + tree: &'tree Tree, 102 + source: &'tree str, 103 + lazy: bool, 104 + visit: F, 105 + ) -> Result<(), E> 106 + where 107 + F: FnMut(&Stanza, QueryMatch<'_, 'tree>) -> Result<(), E>, 108 + { 109 + if lazy { 110 + self.try_visit_matches_lazy(tree, source, visit) 111 + } else { 112 + self.try_visit_matches_strict(tree, source, visit) 113 + } 96 114 } 97 115 } 98 116