/** * Thin wrapper around the `@handlebars/parser` for Marketing Cloud Next. * * Provides a safe parse that converts parser exceptions into a structured * result, plus helpers to map the parser's 1-based-line / 0-based-column * locations onto LSP Positions and to walk every node in the AST. */ import { type AST } from '@handlebars/parser'; import type { Position, Range } from 'vscode-languageserver-types'; /** A node in the Handlebars AST (re-exported for validator consumers). */ export type HandlebarsAstNode = AST.Node; /** A Handlebars syntax error with an LSP range describing where it occurred. */ export interface HandlebarsSyntaxError { message: string; range: Range; } /** Result of attempting to parse a Handlebars document. */ export interface HandlebarsParseResult { /** The parsed program, or null when a syntax error prevented parsing. */ ast: AST.Program | null; /** The syntax error, when parsing failed. */ error: HandlebarsSyntaxError | null; } /** * Convert a parser AST position (1-based line, 0-based column) to an LSP * Position (0-based line and character). * @param pos - The AST position. * @returns The equivalent LSP Position. */ export declare function astPositionToLsp(pos: AST.Position): Position; /** * Convert an AST node's source location to an LSP Range. * @param loc - The AST source location. * @returns The equivalent LSP Range. */ export declare function astLocToRange(loc: AST.SourceLocation): Range; /** * Parse Handlebars source, returning either the AST or a structured syntax error. * Never throws. * @param text - The (already sanitized) Handlebars document text. * @returns The parse result. */ export declare function parseHandlebars(text: string): HandlebarsParseResult; /** * Depth-first walk over every node in a Handlebars AST, invoking the visitor * for each. Traversal descends into block programs/inverses, statement params, * subexpressions, and hash pair values. * @param node - The root node (typically a Program). * @param visit - Callback invoked for every node. */ export declare function walkHandlebars(node: AST.Node, visit: (node: AST.Node) => void): void; //# sourceMappingURL=handlebarsAst.d.ts.map