/** * Small helpers over ANTLR parse-tree contexts. * * The generated API is verbose and nullable in places where our DSL * makes the value mandatory. These helpers normalise access so the * renderer stays readable. They also handle the one token-level bit * the renderer cares about: stripping quotes from attribute values. */ import type { AttrContext, ContentContext, DataElementContext, DataSelfClosedContext, DataWithBodyContext, ElementContext, MapElementContext, OpenCloseElementContext, SelfClosingElementContext } from '../generated/TDCParser.js'; import type { AttrMap } from './attrs.js'; export declare function elementKind(el: ElementContext): { kind: 'data'; node: DataElementContext; } | { kind: 'open'; node: OpenCloseElementContext; } | { kind: 'self'; node: SelfClosingElementContext; } | null; export declare function elementName(el: OpenCloseElementContext | SelfClosingElementContext): string; export declare function extractAttrs(attrs: readonly AttrContext[]): AttrMap; export declare function extractDataText(data: DataElementContext): string; export declare function elementAttrs(node: OpenCloseElementContext | SelfClosingElementContext): AttrMap; export declare function extractDataAttrs(data: DataElementContext): AttrMap; /** * Raw text inside a `…` — the compact `KEY:VALUE, …` table body. * Like `extractDataText`, each MAP_TEXT token is a single character. */ export declare function extractMapText(map: MapElementContext): string; export declare function asDataWithBody(data: DataElementContext): DataWithBodyContext | undefined; export declare function asDataSelfClosed(data: DataElementContext): DataSelfClosedContext | undefined; export declare function contentElements(content: ContentContext | null): ElementContext[]; /** Find the first openCloseElement child named `name` in a content. */ export declare function findChildElement(content: ContentContext | null, name: string): OpenCloseElementContext | undefined; type GenElement = OpenCloseElementContext | SelfClosingElementContext; export interface CollectedSequenceGens { /** All `` nodes in document order — direct and inside ``. */ readonly nodes: GenElement[]; /** One entry per `` wrapper: the `` nodes it groups. */ readonly distinctGroups: readonly GenElement[][]; } /** * Collect the `` children of a ``, descending one level into * any `…` wrapper. * * Returns the flat gen list in document order (so PRNG-consumption order is * preserved) plus, for each `` wrapper, the gens it groups. A * `` with no `` children contributes no group. Only one level * of nesting is inspected — `` does not nest inside ``. */ export declare function collectSequenceGens(seq: OpenCloseElementContext): CollectedSequenceGens; /** * The names of the constant fields in a `` body. * * `import-2026` is a field of the sequence exactly as * a `` is, and `${{Seq.source}}` resolves to it. The validator has * to know about them, or it would flag a reference to one as a typo. */ export declare function dataFieldNames(seq: OpenCloseElementContext): string[]; /** * Whether a `` body holds a `` literal. * * A literal is what makes an otherwise-simple body compose: * ` ` is a full name, and the space between them is not * decoration. */ export declare function hasDataLiteral(seq: OpenCloseElementContext): boolean; /** * Attribute lookup that keeps the `AttrContext` — the node a diagnostic needs to * point at a position rather than at a whole element. * * Lives here beside `extractAttrs`, which answers the same question and throws * the position away. */ export declare function findAttr(attrs: readonly AttrContext[], name: string): AttrContext | undefined; export {}; //# sourceMappingURL=walk.d.ts.map