import { Printer } from "./printer.js"; import type * as Nodes from "@herb-tools/core"; /** * IdentityPrinter - Provides lossless reconstruction of the original source * * This printer aims to reconstruct the original input as faithfully as possible, * preserving all whitespace, formatting, and structure. It's useful for: * - Testing parser accuracy (input should equal output) * - Baseline printing before applying transformations * - Verifying AST round-trip fidelity * * A byte-exact round-trip requires a tree parsed with `track_whitespace: true`, since that is * the only mode in which every whitespace token is represented by a node. Without it the * whitespace separating the parts of an open tag is recovered from the source the nodes were * parsed from, and falls back to a single separating space when that source is unavailable. */ export declare class IdentityPrinter extends Printer { static printERBNode(node: Nodes.ERBNode): string; visitLiteralNode(node: Nodes.LiteralNode): void; visitHTMLTextNode(node: Nodes.HTMLTextNode): void; visitWhitespaceNode(node: Nodes.WhitespaceNode): void; visitHTMLOpenTagNode(node: Nodes.HTMLOpenTagNode): void; visitHTMLCloseTagNode(node: Nodes.HTMLCloseTagNode): void; visitHTMLVirtualCloseTagNode(_node: Nodes.HTMLVirtualCloseTagNode): void; visitHTMLOmittedCloseTagNode(_node: Nodes.HTMLOmittedCloseTagNode): void; visitHTMLElementNode(node: Nodes.HTMLElementNode): void; visitHTMLConditionalElementNode(node: Nodes.HTMLConditionalElementNode): void; visitHTMLAttributeNode(node: Nodes.HTMLAttributeNode): void; visitHTMLAttributeNameNode(node: Nodes.HTMLAttributeNameNode): void; visitHTMLAttributeValueNode(node: Nodes.HTMLAttributeValueNode): void; visitRubyLiteralNode(node: Nodes.RubyLiteralNode): void; visitRubyHTMLAttributesSplatNode(node: Nodes.RubyHTMLAttributesSplatNode): void; visitHTMLCommentNode(node: Nodes.HTMLCommentNode): void; visitHTMLDoctypeNode(node: Nodes.HTMLDoctypeNode): void; visitXMLDeclarationNode(node: Nodes.XMLDeclarationNode): void; visitXMLProcessingInstructionNode(node: Nodes.XMLProcessingInstructionNode): void; visitCDATANode(node: Nodes.CDATANode): void; visitERBOpenTagNode(node: Nodes.ERBOpenTagNode): void; visitERBContentNode(node: Nodes.ERBContentNode): void; visitERBCommentNode(node: Nodes.ERBCommentNode): void; visitERBIfNode(node: Nodes.ERBIfNode): void; visitERBElseNode(node: Nodes.ERBElseNode): void; visitERBEndNode(node: Nodes.ERBEndNode): void; visitERBBlockNode(node: Nodes.ERBBlockNode): void; visitERBIterationBlockNode(node: Nodes.ERBIterationBlockNode): void; visitERBCaseNode(node: Nodes.ERBCaseNode): void; visitERBWhenNode(node: Nodes.ERBWhenNode): void; visitERBWhileNode(node: Nodes.ERBWhileNode): void; visitERBUntilNode(node: Nodes.ERBUntilNode): void; visitERBForNode(node: Nodes.ERBForNode): void; visitERBBeginNode(node: Nodes.ERBBeginNode): void; visitERBRescueNode(node: Nodes.ERBRescueNode): void; visitERBEnsureNode(node: Nodes.ERBEnsureNode): void; visitERBUnlessNode(node: Nodes.ERBUnlessNode): void; visitERBRenderNode(node: Nodes.ERBRenderNode): void; visitRubyRenderKeywordsNode(_node: Nodes.RubyRenderKeywordsNode): void; visitRubyRenderLocalNode(_node: Nodes.RubyRenderLocalNode): void; visitERBStrictLocalsNode(node: Nodes.ERBStrictLocalsNode): void; visitHerbDirectiveNode(node: Nodes.HerbDirectiveNode): void; visitHerbStateDirectiveNode(node: Nodes.HerbStateDirectiveNode): void; visitHerbStateDeclarationNode(_node: Nodes.HerbStateDeclarationNode): void; visitRubyParameterNode(_node: Nodes.RubyParameterNode): void; visitERBYieldNode(node: Nodes.ERBYieldNode): void; visitERBInNode(node: Nodes.ERBInNode): void; visitERBCaseMatchNode(node: Nodes.ERBCaseMatchNode): void; /** * Recover the whitespace separating two adjacent parts of an open tag * * A WhitespaceNode is its own separator, so nothing is written on either side of one. */ protected separatorBetween(source: string | null, from: Nodes.Position, to: Nodes.Position): string; /** * Print ERB node tags and content */ protected printERBNode(node: Nodes.ERBNode): void; }