import { OpenXmlError } from '../utils/exceptions'; import { type Token } from './tokenizer'; export declare class TranslatorError extends OpenXmlError { readonly name = "TranslatorError"; } /** `1:1`, `$1234:78910`, etc. — pure-row range. */ export declare const ROW_RANGE_RE: RegExp; /** `A:A`, `$ABC:AZZ` — pure-column range. */ export declare const COL_RANGE_RE: RegExp; /** `A1`, `$AB$15` — single cell ref. */ export declare const CELL_REF_RE: RegExp; /** * Shift a row-snippet (`"3"` or `"$3"`) by `rdelta` rows. Absolute * anchors return verbatim; falling below row 1 raises `TranslatorError`. */ export declare function translateRow(rowStr: string, rdelta: number): string; /** * Shift a column-snippet (`"A"` or `"$A"`) by `cdelta` columns. Absolute * anchors return verbatim; out-of-range raises `TranslatorError`. */ export declare function translateCol(colStr: string, cdelta: number): string; /** * Split `Sheet!A1` into `["Sheet!", "A1"]`. Multi-`!` sheet names are not * supported by Excel itself, so we just `rsplit('!', 1)`. */ export declare function stripWsName(rangeStr: string): [string, string]; /** * Translate an A1-style range reference (potentially worksheet-prefixed, * potentially a named range) by `(rdelta, cdelta)`. Mirrors openpyxl * `Translator.translate_range` exactly: * * - `1:1` / `$1234:78910` → row-range, only rows shift * - `A:A` / `$ABC:AZZ` → col-range, only cols shift * - `A1:B2` (with `:`) → recurse on each side, allowing named-range endpoints * - `A1` → cell ref * - anything else → assumed named range, returned verbatim */ export declare function translateRange(rangeStr: string, rdelta: number, cdelta: number): string; export interface TranslateOptions { /** Destination cell address ("B2"). When set, derives `rowDelta`/`colDelta` from `origin`. */ dest?: string; /** Explicit row delta. Ignored if `dest` is provided. */ rowDelta?: number; /** Explicit col delta. Ignored if `dest` is provided. */ colDelta?: number; } /** * Translate `formula` (defined at `origin`, e.g. "A1") to its destination * cell. Pass either `{ dest }` or `{ rowDelta, colDelta }`. LITERAL * formulas (input that does not start with `=`) and empty input pass * through untouched. */ export declare function translateFormula(formula: string, origin: string, opts?: TranslateOptions): string; /** * Convenience: tokenize once, expose the parsed list + the same translate * helpers bound to a fixed origin. Mirrors openpyxl's `Translator` object. */ export interface Translator { formula: string; origin: string; row: number; col: number; tokens: Token[]; } export declare function makeTranslator(formula: string, origin: string): Translator; /** Render the translator's tokens back to the source string (sanity check). */ export declare function translatorRender(t: Translator): string;