import { PrintContext, CommentWithPosition } from './types'; import { Value } from '../../utils/types'; import { Statement } from '../../types/Ast.type'; import { Writer } from './Writer'; /** * Printer class - AST → string conversion * * Pure function(s), no access to originalScript. * Uses a Writer to avoid heavy string concatenations. */ export declare class Printer { private static printersRegistry; /** * Print a statement node to code */ static printNode(node: Statement, ctx: PrintContext): string; /** * Print a comment */ static printComment(comment: CommentWithPosition, indentLevel?: number): string; /** * Get value type */ static getValueType(value: Value): 'string' | 'number' | 'boolean' | 'null' | 'object' | 'array'; /** * Convert value type */ static convertValueType(value: Value, targetType: 'string' | 'number' | 'boolean' | 'null' | 'object' | 'array'): Value | null; /** * Print argument/expression code */ static printArg(arg: any, _ctx: PrintContext): string | null; /** * Print a variable reference */ static printVarRef(name: string, path?: any[]): string; /** * Print an into target */ static printIntoTarget(targetName: string, targetPath?: any[]): string; /** * Print assignment node */ static printAssignment(node: any, writer: Writer, ctx: PrintContext): void; /** * Print cell block node */ static printCellBlock(node: any, writer: Writer, ctx: PrintContext): void; /** * Print chunk marker node */ static printChunkMarker(node: any, writer: Writer, _ctx: PrintContext): void; /** * Print command node */ static printCommand(node: any, writer: Writer, ctx: PrintContext): void; /** * Print a comment node */ static printCommentNode(node: any, writer: Writer, _ctx: PrintContext): void; /** * Get leading comments from a statement node. */ private static getLeadingComments; /** * Get inline comment from a statement node. */ static getInlineComment(stmt: any): CommentWithPosition | null; /** * Format an inline comment as a string to append to a line. */ static formatInlineComment(comment: CommentWithPosition | null): string; /** * Emit decorators for a node if they exist. */ private static emitDecorators; /** * Emit leading comments for a statement, preserving blank lines between them. */ static emitLeadingComments(stmt: any, writer: Writer, _ctx: PrintContext, indentLevel: number): boolean; /** * Check if there's a blank line gap between the last comment and a statement. */ static emitBlankLineAfterComments(stmt: any, writer: Writer): void; /** * Check if there's a blank line gap between two statements. */ static emitBlankLineBetweenStatements(prevStmt: any, currentStmt: any, writer: Writer): void; /** * Print define (function definition) node */ static printDefine(node: any, writer: Writer, ctx: PrintContext): void; /** * Print do block node */ static printDo(node: any, writer: Writer, ctx: PrintContext): void; /** * Print think block node (AI reasoning block) */ static printThink(node: any, writer: Writer, ctx: PrintContext): void; /** * Print for loop node */ static printForLoop(node: any, writer: Writer, ctx: PrintContext): void; /** * Print ifBlock node */ static printIfBlock(node: any, writer: Writer, ctx: PrintContext): void; /** * Print on block node */ static printOnBlock(node: any, writer: Writer, ctx: PrintContext): void; /** * Print prompt block node */ static printPromptBlock(node: any, writer: Writer, _ctx: PrintContext): void; /** * Print together block node */ static printTogether(node: any, writer: Writer, ctx: PrintContext): void; }