import type { Combinator, CompiledParser } from '../types.ts'; import type { HostMode } from '../cst/host-mode.ts'; import { type DuplicationOption } from './duplication-hook.ts'; /** * THE CONTRACT DIVERGENCE, stated rather than hidden. * * `CompiledParser.inlineExpression` is documented as a self-contained IIFE with * "no external references". A table artifact cannot honour that clause and stay * a table: the shared driver being EXTERNAL is the entire reason the artifact is * 0.56 MB instead of source lowering's 2.10 MB. Inlining the driver per grammar * reproduces exactly the size this lowering exists to avoid. * * So the expression references `tableRules`, and the consumer is responsible for * having imported it. That is a real change to what an inliner must do, and it * is the reason this is a lowering swap rather than a rename. * * It is NOT null. Returning null would be the quiet failure: `plugin/index.ts` * warns and SKIPS on null, leaving the grammar interpreted — 79 ms against 14 ms * on `benchmark.less`, a ~5x regression that no test would have reported. */ export type TableCompileOptions = { readonly hostMode?: HostMode; readonly trackLines?: boolean; /** * ACCEPTED AND IGNORED — recovery is ALWAYS lowered (see `TableSettings.recovery`). * Kept so this stays a drop-in for `compile(g, …, { recovery: true })`. */ readonly recovery?: boolean; /** * GRAMMAR-COVERAGE COUNTERS, lowered as `OP_COV` rows plus the definition pool * (`TableProgram.cov`). Same ids as the source lowering, because both mint them * from the same `buildGrammarPlan` walk over the same combinator graph. * * COUNTERS ONLY — owner ruling. `_grammarTrace`'s six phases are emitted at * ~40 fine-grained sites by codegen and are deferred to 0.48 * (`notes/RELEASE-0.48-TARGET.md` §1). A table entry rejects a context carrying * a trace sink before parsing: silently returning an empty trace would look * exactly like a real trace whose grammar sites were never visited. The * plugin's coverage path reads `_grammarCoverage` and the definitions stamp, * neither of which is trace. * * The remaining options below are accepted for signature compatibility with * `compile()`. Any that the table lowering cannot honour THROWS rather than * being ignored — a compile that silently drops the instrumentation its caller * asked for is the failure class this project keeps finding, and coverage that * silently reports nothing is worse than a build error that says why. */ readonly coverage?: boolean; readonly duplication?: DuplicationOption; /** Identifier the emitted expression expects to find `tableRules` under. */ readonly runtimeRef?: string; /** Source text per `prog.fns` entry, for a module/expression that must be printable. */ readonly fnSources?: readonly string[]; }; export declare function compile(combinator: Combinator, mapFnSources?: readonly string[], opts?: TableCompileOptions): CompiledParser; //# sourceMappingURL=compile.d.ts.map