export type { Combinator, CompiledParser, ParseResult, ParseOk, ParseFail, ParseContext, ParseError, Span, ParserMeta, FirstSet, CharRange, ParserDef, ChoiceStrategy, AutoNotCheck, GatedArm, DispatchCase, DispatchMatcherCase, BuildHost, CstCollapsePredicate, FieldCapture, FieldMap } from './types.ts' export { literal } from './combinators/literal.ts' export type { LiteralOptions } from './combinators/literal.ts' // `regex()` derives its own first-set: the analyzer (`./regex/first-set.ts`) is // imported directly by `./combinators/regex.ts`, NOT registered here. It used to // be wired in from this entry, which made `regex()`'s first-set depend on whether // the library entry was in the bundle's module graph — and `parseman/table` is a // separate graph, so its `regex()` fell back to the permissive `any()` set and // `classifiedTrivia()` rejected every table-lowered grammar. See the comment on // the import in `./combinators/regex.ts`. export { regex } from './combinators/regex.ts' export { keywords, word, makeWord } from './combinators/keywords.ts' export type { KeywordsOptions, WordOptions } from './combinators/keywords.ts' export { sequence } from './combinators/sequence.ts' export { choice } from './combinators/choice.ts' export { dispatch, endsWith, makeWhen, matches, otherwise, routed, startsWith, when } from './combinators/dispatch.ts' export type { DispatchArm, DispatchOtherwise, DispatchStringMatcher, DispatchWhen, DispatchWhenFactory, DispatchWhenOptions, DispatchWhenMatcher } from './combinators/dispatch.ts' export { attempt } from './combinators/attempt.ts' export { many, oneOrMore, optional, sepBy, oneOrMoreSep, keepSeparator } from './combinators/repeat.ts' export type { RepeatOptions, SepByOptions, TrailingSeparator, KeptSeparator } from './combinators/repeat.ts' export { rules } from './combinators/parser.ts' export { ref } from './combinators/ref.ts' export { not } from './combinators/not.ts' export { peek } from './combinators/peek.ts' export { node } from './combinators/node.ts' export type { BuildNode, NodeCombinator, NodeOptions, NodeProjectOptions } from './combinators/node.ts' // lazy() is intentionally NOT exported. export { transform, trivia, classifiedTrivia, label, field } from './combinators/map.ts' export { parse, parser, noTrivia } from './combinators/grammar.ts' export type { ParseOptions, ParserOptions, ParsemanParser } from './combinators/grammar.ts' export { token, leaf } from './combinators/token.ts' export { compile } from './table/compile.ts' /* * `CompiledParser` is exported above, from `./types.ts` — it is the contract * `compile()` answers to, so it lives with the library's types. * * TWO NAMES USED TO SIT HERE and no longer do. Neither was ever documented and * nothing outside the source lowering referenced either; they were in the barrel * because the barrel re-exported the engine, not because anything asked for them. * * `LinkablePieces` — the SOURCE-LOWERING linkable IR. Every field of it is * source text or an input to resolving source text (see * `compile-linkable-table.ts`), so it has no meaning for a * table artifact and dies with the source lowering. The * public composable-piece type is `LinkableTable`, below. * `DuplicationOption` — an option bag for the source lowering's duplication * diagnostic, used nowhere else. The public diagnostic * surface is `analyzeDuplication` / * `AnalyzeDuplicationOptions`, exported further down. * * `HostMode` stays: it names the `hostMode` option on `rules()` and `compile()`, * which is public. It now comes from the artifact↔host contract module that has * owned the definition all along. */ export type { HostMode } from './cst/host-mode.ts' /** * `linkable()` produces TABLES too — the table counterpart of `compileLinkable`. * A piece is a table when it is self-contained, and always carries its IR, which * is what makes table-to-table composition a rule-map merge and one encode rather * than a merge of two already-encoded programs. */ export { compileLinkableTable, type LinkableTable, type LinkableTableOptions } from './compiler/compile-linkable-table.ts' export type { DuplicationOption } from './table/duplication-hook.ts' // THE diagnostic entry point. `compile()` never reports anything: diagnostics are a // deliberate act, not a side effect of producing an artifact. `diagnoseGrammar` accepts // any grammar shape, returns a deterministic machine-readable object that fails CLOSED, // and `formatGrammarDiagnosis` renders it for a human. // // const d = diagnoseGrammar(myGrammar) // if (!d.ok) { console.error(formatGrammarDiagnosis(d).join('\n')); process.exit(1) } // // `examinedNothing(d)` separates "measured, and it is bad" from "could not measure": // `ok` is false for both, and a gate that treats them the same reports a confident // finding count over a grammar it never opened. // // The `analyze*` functions below remain the lower-level surface it is built on. export { diagnoseGrammar, examinedNothing, formatGrammarDiagnosis } from './analysis/diagnose.ts' export type { GrammarDiagnosis, DiagnosisFinding, DiagnosisCode, DiagnosisSeverity, DiagnosableGrammar, DiagnoseOptions, } from './analysis/diagnose.ts' export { analyzeGating, analyzeGatingRules, formatGatingWarnings, firstSetToString } from './analysis/gating.ts' export type { GatingReport, ChoiceGating, AnyArm, Overlap, AntiPattern, Unanalysable, FirstSetCause, ChoiceStrategyTag, AnalyzeGatingOptions, } from './analysis/gating.ts' // Analyze a WHOLE grammar, including a `compose()` result — whose fused map holds // rule FUNCTIONS, not combinators, and so cannot be walked by `analyzeGatingRules` // directly. This is the entry point a composed grammar's author wants. export { analyzeGrammarGating } from './analysis/grammar.ts' // Choice-cost diagnostics: the static shared-prefix inventory, the interpreted // corpus wasted-work profile, and the gate policy over them. Quiet by default — // nothing here runs or prints unless it is called. export { analyzeChoiceInventory, profileWastedWork, choiceSiteKey, armLabel } from './analysis/choice-cost.ts' export type { ChoiceSite, ChoiceInventoryEntry, ChoiceInventoryReport, PrefixGroup, ArmDeclineReason, SiteDeclineReason, WastedWorkCorpusEntry, ProfileWastedWorkOptions, WastedWorkArm, WastedWorkSite, WastedWorkReport, } from './analysis/choice-cost.ts' export { renderChoiceInventory, renderWastedWork, leftFactorPreview } from './analysis/choice-cost-render.ts' export type { RenderOptions } from './analysis/choice-cost-render.ts' export { checkWastedWork, buildWastedWorkBaseline } from './analysis/choice-cost-gate.ts' export type { WastedWorkBaseline, WastedWorkPolicy, GateBreach, GateVerdict } from './analysis/choice-cost-gate.ts' export type { AnalysableGrammar } from './analysis/grammar.ts' export { analyzeDuplication, analyzeDuplicationRules, formatDuplicationFindings, duplicationFindingCount, siteToString, alternationGroups, keywordRegexShape, extractCharClasses, charClassMembers, keywordAlternationHazards, } from './analysis/duplication.ts' export type { DuplicationReport, AnalyzeDuplicationOptions, DuplicationWarnLevel, Site, DuplicateFinding, NearDuplicateFinding, RegexFragmentFinding, RegexClassFinding, RegexClassVariant, ArmOverlapFinding, RewriteFinding, RewriteKind, SepByVerdict, KeywordRegexFinding, DivergentNodeFinding, StructureLossFinding, } from './analysis/duplication.ts' // `composeLeaf()` is terminal by design; ordinary reusable grammar composition is // `compose()`. There is no à-la-carte rule selection: compose small pieces instead. // // `fuseInterpreted()` / `isInterpretedFuse()` are deliberately NOT re-exported. The // interpreted fuse is a DIAGNOSTIC engine — it is how the differential harnesses and // bench legs run a grammar without reaching codegen — not a supported way to ship a // parser. Publishing it advertised a second engine with the same grammar and different // runtime characteristics, and `isInterpretedFuse` existed as an escape hatch that not // even Parseman called. Both stay internal (./compiler/linker.ts). // // Withdrawing the discriminator is only safe because `composeLeaf()` no longer LIES // about which engine it returned: it is typed `Record`, true on both // paths, and `Runnable` is what `run()`/`parseDoc()` take. Were that type ever narrowed // back to `FusedRule`, `isInterpretedFuse` would have to be re-exported in the same // change — a dual shape with no way to detect it is the worse of the two. export { compose, composeLeaf, cstBuildHost } from './compiler/linker.ts' export type { CstBuildHostOptions, FusedRule } from './compiler/linker.ts' export { buildLineIndex, createLineIndex, recordLineRange, normalizeLineIndex, offsetToLineCol, annotateSpan, annotateTreeSpans } from './line-index.ts' export type { LineIndex } from './line-index.ts' export { gate } from './combinators/gate.ts' export { adjacent, notAdjacent } from './combinators/adjacency.ts' export { withCtx } from './combinators/withCtx.ts' export { isParseError } from './combinators/expect.ts' export { expect } from './combinators/expect.ts' export { completionsAt } from './combinators/completions.ts' export { scanTo, balanced } from './combinators/scanTo.ts' export type { ScanToOptions } from './combinators/scanTo.ts' export type { CSTNode, CSTLeaf, CSTError, CSTTrivia, CSTChild, CSTRawChild, NodeLike } from './cst/types.ts' export { parseDoc } from './functional/doc.ts' export type { ParseDoc, ParseDocOptions, Registry, RuleFn } from './functional/doc.ts' /* THE PUBLIC PARSE PATH IS THE TABLE. `functional/run.ts` is the driver and * still walks a combinator directly when handed one — that branch is the * interpreter, and it stays reachable from `test/` and the identity sweep so a * table/codegen divergence has something to be bisected against. It is not what * the main entry hands out. See `functional/run-tabled.ts` for why the encode * cannot live inside the driver (`parseman/run`'s closure) and why the cache is * load-bearing rather than an optimisation. */ export { run } from './functional/run-tabled.ts' export type { RootTriviaCapture, RunResult, RunOptions, Runnable } from './functional/run.ts' export { GRAMMAR_COVERAGE_DEFINITIONS, compiledGrammarCoverageDefinitions, createGrammarCoverageCollector, createGrammarInstrumentationContext, createGrammarTraceSink, grammarCoverageDefinitions, composedGrammarCoverageDefinitions, runWithGrammarCoverage } from './coverage.ts' export type { GrammarCoverageCollector, GrammarCoverageDefinition, GrammarCoverageSnapshot, GrammarInstrumentationContext, GrammarTraceEvent, GrammarTracePhase, GrammarTraceSink, GrammarTraceSnapshot } from './coverage.ts' export { buildTriviaIndex } from './cst/trivia-index.ts' export type { TriviaIndex, TriviaToken, TriviaIndexOptions } from './cst/trivia-index.ts' export { createVisitor } from './cst/walk.ts' export type { Walkable, VisitorHandler, VisitorSpec } from './cst/walk.ts' export type { GrammarReflection, GrammarNodeReflection, GrammarWithReflection } from './cst/reflection.ts' export { buildRootTriviaIndex, triviaEntries } from './cst/trivia-entries.ts' export type { RootTriviaGap, RootTriviaIndex, TriviaEntriesView } from './cst/trivia-entries.ts' export { triviaKindMask } from './cst/trivia-kinds.ts' export { relativize, absolutize, absoluteSpanAt, shiftAbsolute, applyEdit, relativizeCST, absolutizeCST, absoluteSpanCST, } from './cst/relative-spans.ts' export type { AbsNode, RelNode } from './cst/relative-spans.ts'