Skip to main content

LanguageParser

Trait LanguageParser 

Source
pub trait LanguageParser: Send + Sync {
    // Required methods
    fn language(&self) -> Language;
    fn file_extensions(&self) -> &[&str];
    fn parse(&self, source: &[u8], path: &Path) -> Result<ParseResult>;
}
Expand description

Trait for language-specific tree-sitter parsers. Implementations must be Send + Sync so the registry can be shared across threads.

Required Methods§

Source

fn language(&self) -> Language

Which domain Language this parser handles.

Source

fn file_extensions(&self) -> &[&str]

File extensions this parser handles (without leading dot).

Source

fn parse(&self, source: &[u8], path: &Path) -> Result<ParseResult>

Parse source code and extract symbols, edges, imports, exports. path is the project-relative file path (used for qualified names).

Implementors§