/** * Structural SQL Parser for Composition IR * * SQL-context-aware parser that produces a {@link QueryIR} for the composition * engine. Unlike MJLexer (which splits purely on brace patterns without regard * for SQL context), this parser understands: * * - `'{{ X }}'` is a template expression inside a SQL string literal * - `/* ... {{ X }} ... *​/` is a template token inside a block comment * - `WITH ... AS (...)` boundaries for CTE detection * - Top-level ORDER BY position (not inside subqueries/window functions) * * The parser produces Fragment[] sequences that the composition engine * manipulates structurally (hoisting CTEs, stripping ORDER BY, renaming * references) before the IR renderer emits SQL with template tokens intact * for Nunjucks evaluation. */ import type { SQLParserDialect } from '@memberjunction/sql-dialect'; import type { QueryIR } from './compositionIR.js'; /** * Parses SQL (potentially containing MJ template tokens) into a QueryIR. * * @param sql - Raw SQL with potential {{query:"..."}}, {{ var }}, {% %} tokens * @param dialect - SQL dialect for parsing and identifier quoting * @returns Structural IR for composition manipulation */ export declare function ParseToIR(sql: string, dialect: SQLParserDialect): QueryIR; /** * Renders a QueryIR back to a SQL string with {{ }}/{% %} tokens intact. * * This is the single code path that emits SQL from the composition engine. * All template tokens are preserved verbatim for downstream Nunjucks evaluation. */ export declare function RenderIR(ir: QueryIR, _dialect: SQLParserDialect): string; //# sourceMappingURL=structuralParser.d.ts.map