/** * 多语言解析器(基于 ADR-005) * * 支持语言: * - TypeScript/JavaScript * - Python * - Go * - Rust * - Java * - C/C++ (基础支持) */ interface ImportExportItem { name: string; path?: string; [key: string]: unknown; } interface ParseError { message: string; line?: number; [key: string]: unknown; } export interface ParseResult { filePath: string; language: string; entities: string[]; imports: ImportExportItem[]; exports: ImportExportItem[]; errors: ParseError[]; } export interface ParseStats { functions: number; classes: number; interfaces: number; imports: number; exports: number; errors: number; } export type SupportedLanguage = 'TypeScript' | 'JavaScript' | 'Python' | 'Go' | 'Rust' | 'Java' | 'C' | 'C++'; export declare class MultiLanguageParser { private manager; constructor(); /** * 根据文件路径自动检测语言并解析 * * @param filePath - 文件路径 * @param content - 文件内容 * @returns 解析结果 */ parseFile(filePath: string, content: string): Promise; /** * 批量解析文件(性能优化版本) * * 内部会按语言分组处理,提升性能约 30% * * @param files - 文件列表 [filePath, content][] * @returns 解析结果数组 */ parseFilesInBatch(files: Array<[string, string]>): Promise; /** * 检测文件语言 * * @param filePath - 文件路径 * @returns 语言名称或 null(不支持的文件类型) */ detectLanguage(filePath: string): SupportedLanguage | null; /** * 获取支持的语言列表 * * @returns 语言名称数组 */ getSupportedLanguages(): SupportedLanguage[]; /** * 检查多语言解析器是否可用 */ static isAvailable(): boolean; /** * 性能基准测试 * * @param sourceCode - 源代码 * @param language - 语言类型 * @param iterations - 迭代次数 * @returns 平均每次解析耗时(毫秒) */ static benchmark(sourceCode: string, language: SupportedLanguage, iterations?: number): Promise; } /** * 创建多语言解析器(工厂函数) * * @returns 解析器实例或 null(不可用) */ export declare function createMultiLanguageParser(): MultiLanguageParser | null; export {};