* 获取所有匹配的解析器(按优先级排序) * 用于 fallback 机制 * @param filePath 文件路径 * @returns 所有匹配的解析器列表
(filePath: string)
| 143 | * @returns 所有匹配的解析器列表 |
| 144 | */ |
| 145 | getParserCandidates(filePath: string): Parser[] { |
| 146 | const ext = getExtension(filePath) |
| 147 | const headContent = readFileHead(filePath) |
| 148 | const results: Parser[] = [] |
| 149 | |
| 150 | for (const { feature, parser } of this.formats) { |
| 151 | if (this.matchFeature(feature, ext, headContent, filePath)) { |
| 152 | results.push(parser) |
| 153 | } |
| 154 | } |
| 155 | |
| 156 | return results |
| 157 | } |
| 158 | |
| 159 | /** |
| 160 | * 根据格式 ID 获取解析器 |
nothing calls this directly
no test coverage detected