pub struct AstGrepEngine { /* private fields */ }Expand description
The unified extraction engine.
Implementations§
Source§impl AstGrepEngine
impl AstGrepEngine
Sourcepub fn find_language(&self, ext: &str) -> Option<&LanguageRules>
pub fn find_language(&self, ext: &str) -> Option<&LanguageRules>
Look up the rules for a given file extension.
Sourcepub fn supports_extension(&self, ext: &str) -> bool
pub fn supports_extension(&self, ext: &str) -> bool
Check if a given extension is supported.
pub fn extract_symbols( &self, lang: &LanguageRules, source: &str, file_path: &str, ) -> Vec<Symbol>
Sourcepub fn extract_symbols_from_tree(
&self,
lang: &LanguageRules,
root: &AstGrep<StrDoc<SupportLang>>,
source: &str,
file_path: &str,
) -> Vec<Symbol>
pub fn extract_symbols_from_tree( &self, lang: &LanguageRules, root: &AstGrep<StrDoc<SupportLang>>, source: &str, file_path: &str, ) -> Vec<Symbol>
C1: Extract symbols from a pre-parsed AST tree, avoiding re-parsing.
Sourcepub fn extract_references(
&self,
lang: &LanguageRules,
source: &str,
file_path: &str,
) -> Vec<Reference>
pub fn extract_references( &self, lang: &LanguageRules, source: &str, file_path: &str, ) -> Vec<Reference>
Parse source code and extract references, deduplicating by (source_qualified_name, target_name, reference_kind).
Sourcepub fn extract_references_from_tree(
&self,
lang: &LanguageRules,
root: &AstGrep<StrDoc<SupportLang>>,
source: &str,
file_path: &str,
) -> Vec<Reference>
pub fn extract_references_from_tree( &self, lang: &LanguageRules, root: &AstGrep<StrDoc<SupportLang>>, source: &str, file_path: &str, ) -> Vec<Reference>
C1: Extract references from a pre-parsed AST tree, avoiding re-parsing.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for AstGrepEngine
impl RefUnwindSafe for AstGrepEngine
impl Send for AstGrepEngine
impl Sync for AstGrepEngine
impl Unpin for AstGrepEngine
impl UnsafeUnpin for AstGrepEngine
impl UnwindSafe for AstGrepEngine
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more