pub fn analyze_str(
source: &str,
language: &str,
ast_recursion_limit: Option<usize>,
) -> Result<FileAnalysisOutput, AnalyzeError>Expand description
Analyze source code from a string buffer without filesystem access.
This function analyzes in-memory source code by language identifier. The language
parameter can be either a language name (e.g., "rust", "python", "go") or a file
extension (e.g., "rs", "py").
Accepted language identifiers depend on compiled features. Use supported_languages() to
discover the available language names at runtime, and language_for_extension() to resolve
a file extension to its supported language identifier.
§Arguments
source- The source code to analyzelanguage- The language identifier (language name or extension)ast_recursion_limit- Optional limit for AST traversal depth
§Returns
Ok(FileAnalysisOutput)on successErr(AnalyzeError::UnsupportedLanguage)if the language is not recognizedErr(AnalyzeError::Parser)if parsing fails
§Notes
- Python wildcard import resolution is skipped for in-memory analysis (no filesystem path available)
- The formatted output uses the standard file-details formatter, so it includes a
FILE:header with an empty path