( ce: ComputeEngine, docs: RubiRuleDoc[] )
| 238 | }; |
| 239 | } |
| 240 | |
| 241 | /** Compile an ordered list of corpus rule-docs into match-ready rules, |
| 242 | * preserving document/rule order as the dispatch priority. This is the |
| 243 | * shippable, fs-free core consumed by both the bundled `loadIntegrationRules` |
| 244 | * loader and the Node `compileSection` fs wrapper (`scripts/rubi/compile.ts`). */ |
| 245 | export function compileRuleDocs( |
| 246 | ce: ComputeEngine, |
| 247 | docs: RubiRuleDoc[] |
| 248 | ): CompileResult { |
| 249 | const rules: CompiledRule[] = []; |
| 250 | const skipped: CompileResult['skipped'] = []; |
| 251 | let priority = 0; |
| 252 | for (const doc of docs) { |
| 253 | for (const r of doc.rules) { |
| 254 | const id = `${doc.file}#${r.index}`; |
| 255 | const { rule, reason } = compileRule(ce, r, id, priority++); |
| 256 | if (rule) rules.push(rule); |
| 257 | else skipped.push({ id, reason: reason! }); |
| 258 | } |
| 259 | } |
no test coverage detected