/** * Mermaid Parser and Pretty Printer * * Provides functionality to parse Mermaid diagram syntax into an AST * and convert AST back to formatted Mermaid syntax. * * Validates: Requirements 8.1, 8.2, 8.3, 8.4, 8.5, 8.6 */ /** * Represents a node in the Mermaid AST */ export interface MermaidNode { id: string; label: string; shape: 'rectangle' | 'rounded' | 'circle' | 'diamond' | 'cylinder' | 'stadium' | 'hexagon'; } /** * Represents an edge in the Mermaid AST */ export interface MermaidEdge { from: string; to: string; label?: string; style: 'solid' | 'dashed' | 'dotted' | 'thick'; } /** * Represents a subgraph in the Mermaid AST */ export interface MermaidSubgraph { id: string; label: string; nodes: string[]; subgraphs?: MermaidSubgraph[]; } /** * Represents a style definition in the Mermaid AST */ export interface MermaidStyle { nodeId: string; styles: Record; } /** * Represents the Mermaid Abstract Syntax Tree */ export interface MermaidAST { type: 'graph' | 'flowchart'; direction: 'TB' | 'LR' | 'BT' | 'RL'; nodes: MermaidNode[]; edges: MermaidEdge[]; subgraphs: MermaidSubgraph[]; styles: MermaidStyle[]; init?: Record; } /** * Result of parsing Mermaid syntax */ export interface ParseResult { success: boolean; ast?: MermaidAST; errors?: ParseError[]; } /** * Represents a parsing error */ export interface ParseError { line?: number; message: string; context?: string; } /** * Result of validation */ export interface ValidationResult { valid: boolean; errors: ParseError[]; } /** * MermaidParser - Parses Mermaid diagram syntax into an AST * * Validates: Requirements 8.1, 8.2 */ export declare class MermaidParser { private currentLine; /** * Parse Mermaid syntax into an AST */ parse(mermaidSyntax: string): ParseResult; /** * Validate Mermaid syntax */ validate(mermaidSyntax: string): ValidationResult; private parseHeader; private parseInitBlock; private parseSubgraph; private parseStyle; private parseEdge; private parseNode; private ensureNodeExists; } /** * MermaidPrettyPrinter - Converts AST to formatted Mermaid syntax * * Validates: Requirements 8.3, 8.4 */ export declare class MermaidPrettyPrinter { private indentSize; /** * Convert AST to formatted Mermaid syntax */ print(ast: MermaidAST): string; /** * Format existing Mermaid syntax */ format(mermaidSyntax: string): string; private printSubgraph; private formatNode; private formatNodeId; private formatEdge; private formatStyle; private escapeLabel; } /** * Round-trip test helper * Validates: Requirement 8.5 */ export declare function roundTripTest(mermaidSyntax: string): { success: boolean; original: string; result: string; error?: string; }; //# sourceMappingURL=MermaidParser.d.ts.map