import { type CorpusProvenance } from './corpus.js'; /** The two normative textual grammars, corpus-relative. */ export declare const TEXTUAL_BNF_FILES: readonly ["bnf/KerML-textual-bnf.kebnf", "bnf/SysML-textual-bnf.kebnf"]; /** One production of a normative grammar. */ export interface BnfProduction { name: string; /** Corpus-relative file it is declared in. */ source: string; /** 1-indexed line of the declaration. */ line: number; /** * True for lexical productions — `LINE_TERMINATOR`, `DECIMAL_VALUE`. * * Reported apart from syntactic ones because a Langium grammar implements * them as terminals, not as parser rules, so scoring them against rule * names would count a category error as a gap. */ lexical: boolean; } export type CoverageStatus = 'covered' | 'missing'; export interface ProductionCoverage extends BnfProduction { status: CoverageStatus; /** The Langium rule or terminal that covers it, when one does. */ implementedBy?: string; } export interface BnfCoverageReport { reportVersion: string; memoVersion: string; corpus: CorpusProvenance; grammar: { path: string; parserRules: number; terminals: number; }; totals: { syntactic: { total: number; covered: number; }; lexical: { total: number; covered: number; }; /** Langium rules with no counterpart in either normative grammar. */ nonNormativeRules: number; }; productions: ProductionCoverage[]; /** * Rules the Langium grammar has that the normative grammars do not name. * * Not a defect on its own — MEMO's grammar has helper rules and MEMO-specific * constructs — but worth listing, because a rule invented where a normative * production already exists is how a grammar drifts from the standard while * its coverage number goes up. */ nonNormativeRules: string[]; } export declare const BNF_REPORT_VERSION = "1.0.0"; export declare function readBnfProductions(path: string, source: string): BnfProduction[]; export interface LangiumGrammar { path: string; parserRules: string[]; terminals: string[]; } /** * Rule and terminal names declared by a Langium grammar. * * A deliberately shallow read of the `.langium` file: this scores *names*, so * loading Langium's own grammar services to get the same list would add a * dependency and a build step for no extra information. */ export declare function readLangiumGrammar(path: string): LangiumGrammar; /** Where the grammar lives, relative to the built or source module. */ export declare function defaultGrammarPath(): string; export interface BnfCoverageOptions { corpusDir?: string; grammarPath?: string; memoVersion: string; } export declare function runBnfCoverage(options: BnfCoverageOptions): BnfCoverageReport; export declare function formatBnfCoverageReport(report: BnfCoverageReport, options?: { missing?: boolean; }): string; //# sourceMappingURL=bnf.d.ts.map