import type { Combinator } from '../types.ts'; import type { TableProgram } from './program.ts'; import type { GrammarCoveragePlan } from '../compiler/grammar-coverage-ids.ts'; /** Raised when a construct has no opcode yet. Prototype scope is explicit. */ export declare class UnsupportedConstruct extends Error { readonly tag: string; constructor(tag: string); } /** Settings that select the TABLE'S CONTENTS. They never reach the driver. */ export type TableSettings = { readonly hostMode?: 'ast' | 'cst'; readonly trackLines?: boolean; /** * ACCEPTED AND IGNORED. RECOVERY IS ALWAYS LOWERED (owner ruling). * * It used to be opt-in because the sync sentinel a list resyncs to is derived * from grammar structure and so has to be known before the table exists — a * BUILD setting for the same reason `hostMode` is. The consequence was a * `CompiledParser` whose `parseWithErrors()` THREW unless the caller had * happened to pass a flag `compile()` does not require, which is a contract * break against the source lowering, not a trade. * * The cost of always lowering it is the extra rows, measured on the emitted * module: json 1,081 → 1,214 B (+12.3%), graphql 2,925 → 3,397 B (+16.1%). * Against codegen's 15,138 B for the same json root the table is still ~12× * smaller, so the size argument for making it optional no longer holds. * * LOWERING RECOVERY IS NOT RUNNING IT. Every recovery path stays gated on * `ctx._tolerant` — the same dormancy the source lowering emits * (`codegen.ts:3153`) and the interpreter tests (`repeat.ts:163`) — so a strict * parse is strict, and `test/parity/table-recovery-always.test.ts` pins that. * * The field is kept rather than deleted so `compile` stays signature- * compatible with `compile()`, whose `{ recovery: true }` is real. Passing it * is harmless; passing `false` does NOT switch recovery off, and saying so here * is the point — a setting that silently means nothing is the defect class this * project keeps finding. */ readonly recovery?: boolean; /** * THE COVERAGE PLAN, when this table is being encoded for grammar coverage. * * Its maps are keyed by COMBINATOR IDENTITY, which is what makes threading the * plan through the encoder exact: at the moment a choice, dispatch, label or * rule body is laid down, the combinator being encoded IS the key, so no code * offset has to be matched back to a structural path after the fact. `OP_COV` * rows go in beside those sites and the plan's definitions become `prog.cov`. * * A plan is a BUILD input for the same reason `hostMode` is: the rows either * exist in the table or they do not, and no per-parse flag can conjure them. * Which of the resulting assemblies actually counts is the separate, * assembly-selected question `RunCfg.coverage` answers. */ readonly coverage?: GrammarCoveragePlan; }; export declare function encodeTable(ruleMap: Record>, settings?: TableSettings): TableProgram; /** * `encodeTable` PLUS the reducer sources, for a caller that must PRINT the table. * * The sources are not on `TableProgram` because they are not data the driver * reads and must never travel in an emitted artifact; they are the printer's * input, in `prog.fns` order. A build that lowers macro-evaluated combinators * gets a real source per entry (`fnSrc` / `buildSrc` / `predSrc` / `gateSrcs`, * set by the macro evaluator); a runtime caller gets `null`s and must therefore * refuse to print rather than emit `() => {}` placeholders. */ export declare function encodeTableProgram(ruleMap: Record>, settings?: TableSettings): { prog: TableProgram; fnSrcs: (string | null)[]; }; //# sourceMappingURL=encode.d.ts.map