/** * Compilation front-end: `source string → AST`. * * Combines the {@link Tokenizer} and {@link Parser} behind one call, strips the * leading `=` that marks a formula, and normalizes both scan and parse failures * into a single {@link CompileResult}. This is the boundary the rest of the * engine (and the {@link ExpressionCache}) compiles through. * * @packageDocumentation */ import type { AstNode } from './parser/ast.types'; import type { ResolvedFormulaConfig } from './config/formula-config'; /** The result of compiling a formula source string. */ export interface CompileResult { /** The parsed AST, or `null` on failure. */ readonly ast: AstNode | null; /** Non-null on failure: a message and the source offset of the problem. */ readonly error: { message: string; position: number; } | null; } /** * Returns the expression body of a formula — everything after a single leading * `=`. Leading whitespace before the `=` is tolerated. A source without `=` is * returned unchanged (callers should have already decided it is a formula). * * @param source - The raw cell source (e.g. `"=SUM(A1:A2)"`). * @returns The body (`"SUM(A1:A2)"`). */ export declare function stripFormulaPrefix(source: string): string; /** * `true` when `source` should be treated as a formula (starts, ignoring leading * whitespace, with `=`). * * @param source - The raw cell source. */ export declare function isFormulaSource(source: unknown): source is string; /** * Tokenizes and parses a formula source into an AST. * * @param source - The raw formula source, including the leading `=`. * @param config - Resolved engine configuration (separators). * @returns The AST or a positioned error. */ export declare function compileFormula(source: string, config: ResolvedFormulaConfig): CompileResult; //# sourceMappingURL=compile.d.ts.map