Skip to main content

LanguageParser

Trait LanguageParser 

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

Contract every language parser must satisfy.

Implementations are stateless — a parser value is cheap to create and safe to reuse across files. Parsing is purely functional: source text in, graph nodes + edges out. Cross-file edges are resolved by the indexer after all files in the diff have been parsed.

Required Methods§

Source

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

File extensions this parser handles (lower-case, without the dot).

Source

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

Parse source (content of path) and return all nodes, edges, and unresolved call references found in that file.

Implementors§