Expand description
Parser module - the heart of code analysis.
This module wraps Tree-sitter and provides a clean API for parsing source files into CodeNodes. Language detection is automatic based on file extension.
Functionsยง
- detect_
language - Detects the programming language from a file path.
- parse_
file - Parses a source file and extracts all code nodes.
- parse_
file_ usages - SDK usages for a file on disk, with the path as written used in records.
Ok(None)when the file has no usage extractor: its extension is not incrate::usages::is_usage_extensionand, for a file without one, its first line is not a Python shebang. Other files are not read past that. - parse_
source - Parses source code directly (useful for testing or in-memory content).
- parse_
source_ usages - SDK usages for in-memory source.
Ok(None)when the language has no usage extractor (today: every language except Python). A file that mentions no tracked SDK is not parsed at all. - parse_
source_ with_ usages - Parses source once and returns both the graph nodes and the SDK usages
(see
crate::usages). The nodes are exactly whatparse_sourcereturns; usages areNonewhen the language has no usage extractor.