pub struct AstParser { /* private fields */ }Expand description
Multi-language AST parser using tree-sitter Thread-safe via interior mutability for parser caching.
Implementations§
Source§impl AstParser
impl AstParser
Sourcepub fn parse_and_extract(
&self,
source: &str,
language: &str,
) -> Result<Vec<ExtractedSymbol>>
pub fn parse_and_extract( &self, source: &str, language: &str, ) -> Result<Vec<ExtractedSymbol>>
Parse source code and extract symbols
Sourcepub fn parse_by_extension(
&self,
source: &str,
ext: &str,
) -> Result<Vec<ExtractedSymbol>>
pub fn parse_by_extension( &self, source: &str, ext: &str, ) -> Result<Vec<ExtractedSymbol>>
Parse source code by file extension
Sourcepub fn parse_file(
&self,
path: &Path,
source: &str,
) -> Result<Vec<ExtractedSymbol>>
pub fn parse_file( &self, path: &Path, source: &str, ) -> Result<Vec<ExtractedSymbol>>
Parse a file and extract symbols (convenience method for indexer)
Sourcepub fn parse_calls(
&self,
path: &Path,
source: &str,
) -> Result<Vec<FunctionCall>>
pub fn parse_calls( &self, path: &Path, source: &str, ) -> Result<Vec<FunctionCall>>
Parse a file and extract function calls (convenience method for indexer)
Sourcepub fn extract_imports(
&self,
source: &str,
language: &str,
) -> Result<Vec<Import>>
pub fn extract_imports( &self, source: &str, language: &str, ) -> Result<Vec<Import>>
Extract imports from source code
Sourcepub fn extract_calls_by_language(
&self,
source: &str,
language: &str,
current_function: Option<&str>,
) -> Result<Vec<FunctionCall>>
pub fn extract_calls_by_language( &self, source: &str, language: &str, current_function: Option<&str>, ) -> Result<Vec<FunctionCall>>
Extract function calls from source code
Sourcepub fn supported_languages() -> &'static [&'static str]
pub fn supported_languages() -> &'static [&'static str]
Get supported languages
Sourcepub fn supported_extensions() -> &'static [&'static str]
pub fn supported_extensions() -> &'static [&'static str]
Get supported file extensions
Sourcepub fn is_language_supported(language: &str) -> bool
pub fn is_language_supported(language: &str) -> bool
Check if a language is supported
Sourcepub fn is_extension_supported(ext: &str) -> bool
pub fn is_extension_supported(ext: &str) -> bool
Check if a file extension is supported
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for AstParser
impl RefUnwindSafe for AstParser
impl Send for AstParser
impl Sync for AstParser
impl Unpin for AstParser
impl UnwindSafe for AstParser
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