/** * MJ Lexer — Tokenizes MJ SQL extensions (Nunjucks templates, composition tokens) * * Scans SQL character-by-character, extracting MJ tokens while preserving * position information for later placeholder substitution and reconstruction. * * The three MJ syntax layers have unambiguous delimiters: * - {{ ... }} — Template expressions and composition references * - {% ... %} — Block tags (if/elif/else/endif/for/endfor/set) * - {# ... #} — Template comments * * None of these sequences appear in valid SQL, so the lexer can reliably * distinguish MJ tokens from SQL text without context-sensitive parsing. */ import { MJToken, MJFilter, MJParseResult } from './mj-ast-types.js'; /** * Tokenizes MJ SQL into an ordered list of MJ tokens and SQL text segments. */ export declare class MJLexer { /** * Tokenize a SQL string containing MJ extensions. * Returns tokens in source order, with SQL_TEXT tokens for non-MJ segments. */ static Tokenize(sql: string): MJToken[]; /** * Convenience method that tokenizes and returns a summary result. */ static Parse(sql: string): MJParseResult; /** * Reads a double-delimited token (e.g., {{ ... }}, {% ... %}, {# ... #}). * Returns null if the closing delimiter is not found. */ private static readDoubleDelimited; /** * Flushes accumulated SQL text as a SQL_TEXT token. */ private static flushSQLText; /** * Parses the content of a {{ ... }} token. * Determines if it's a composition reference or a template expression. */ private static parseExpressionToken; /** * Parses a template expression like: Region | sqlString | default('US') */ private static parseTemplateExpr; /** * Parses a filter chain like: "varName | filter1 | filter2('arg')" * into a variable name and filter array. */ static parseFilterChain(content: string): { variable: string; filters: MJFilter[]; }; /** * Splits on pipe characters, respecting quoted strings and parentheses. */ private static splitPipes; /** * Parses a single filter like "sqlString", "default('N/A')", or "sqlNumber". */ private static parseSingleFilter; /** * Parses filter arguments, handling quoted strings and numeric literals. */ private static parseFilterArgs; /** * Parses a composition reference like: query:"Path/Name(p1='v1', p2=var)" */ private static parseCompositionRef; /** * Parses composition parameters like: p1='literal', p2=variable, p3={{nunjucks}} */ private static parseCompositionParams; /** * Splits composition argument string on commas, respecting nested {{ }} and quotes. */ private static splitCompositionArgs; /** * Parses a block tag and returns the appropriate token type. */ private static parseBlockTag; /** * Creates a block tag token with standard MJBlockTagContent. */ private static makeBlockToken; } //# sourceMappingURL=mj-lexer.d.ts.map