import { type ParseTree, type Token } from "antlr4ng"; export interface PartSpan { /** Absolute char offset of the part's first token, inclusive (0-based). */ start: number; /** Absolute char offset one past the part's last token, exclusive (0-based). */ end: number; /** 1-based line of the part's first token (matches src/parse-diagnostics.ts SyntaxDiagnostic). */ line: number; /** 0-based column of the part's first token (matches src/parse-diagnostics.ts SyntaxDiagnostic). */ column: number; /** 1-based line of the span END (one past the last char) — same convention as symbols.ts `Span`. */ endLine: number; /** 0-based column of the span END (one past the last char). */ endColumn: number; } /** The span of a single part's CST node (a rule context or terminal). `undefined` when the node is * missing or carries no token — the caller treats that as "this part has no real token". */ export declare function partSpanOf(node: ParseTree | null | undefined): PartSpan | undefined; /** The `PartSpan` of the identifier inside a fused dot-glued token — one lexer token whose text is a * leading dot immediately followed by a plain identifier (MySQL `DOT_ID: '.' ID_LITERAL`, produced * for the unspaced `a.b` writing style). The dot is NOT part of the identifier, so the span starts * one char past the token start and runs to the token end; the identifier is the token's tail. Its * offsets are interchangeable with a span `partSpanOf` would produce from a real identifier node. * `ID_LITERAL` admits only a plain unquoted identifier — a quoted part lexes as a separate quoted-id * token and takes the `'.' uid` parser path instead — so no quoting delimiter can hide in this span, * and the token is single-line (`.` + identifier, no newline), so `endLine === line`. */ export declare function dotIdPartSpanOf(symbol: Token): PartSpan; /** All-or-nothing collapse over already-computed spans: one array only when EVERY part produced a real * span, else `undefined`. The single shared implementation of the convention so `partSpans` / * `namePartSpans` never misaligns with `parts`. `partSpansOf` (node-derived spans) delegates here; * callers that MIX node-derived spans with directly-computed ones (MySQL's fused DOT_ID part, whose * span comes from `dotIdPartSpanOf`, not a node) call this with the mixed span list. */ export declare function collapsePartSpans(spans: (PartSpan | undefined)[]): PartSpan[] | undefined; /** All-or-nothing per column reference: return one `PartSpan` per node only when EVERY part has a * real token; otherwise `undefined`. A synthesized part — postgres's empty-segment `d.s..c`, a * dotted single-token path (BigQuery DOT_IDENTIFIER), star-expansion internals, pipe-stage * synthetics — yields `undefined` for the whole ref, so `partSpans` never misaligns with `parts`. */ export declare function partSpansOf(nodes: (ParseTree | null | undefined)[]): PartSpan[] | undefined; /** The literal `*` terminal within a star projection's CST subtree — the star's OWN span, excluding * any qualifier (`t.` in `t.*`) and any trailing modifier clause (`EXCEPT (...)`/`EXCLUDE (...)`/ * `REPLACE (...)`). Every dialect's star `Expr.cst` covers, at most, qualifier + `*` + modifiers — * never just the `*` alone (see docs/identifier-delimiter-contract.md's sibling concern for column * text; this is the span analogue for stars) — and there is no shared per-dialect token-type constant * to key on at this dialect-agnostic layer. So this walks the subtree pre-order (left to right) and * returns the FIRST terminal whose text is exactly "*": the projection's own star always precedes any * modifier clause in source order, so "first" finds it unambiguously even when a `REPLACE (a * 2 AS * c)` modifier's own expression contains a `*` multiplication operator later in the same subtree. * `undefined` only if the subtree genuinely carries no `*` token (a broken/synthesized star). */ export declare function starSpanOf(node: ParseTree | null | undefined): PartSpan | undefined;