UNPKG

rawsql-ts

Version:

[beta]High-performance SQL parser and AST analyzer written in TypeScript. Provides fast parsing and advanced transformation capabilities.

42 lines (41 loc) 1.49 kB
export type NewlineOption = ' ' | '\n' | '\r\n'; export type IndentCharOption = '' | ' ' | '\t'; /** * SqlPrintHelper provides utility methods for SQL pretty printing. */ export declare class LinePrinter { indentChar: IndentCharOption; indentSize: number; newline: NewlineOption; lines: PrintLine[]; /** * @param indentChar Character used for indentation (default: ' ') // Updated comment to reflect options * @param indentSize Number of indentChar per level (default: 0) * @param newline Newline string (default: '\r\n') // Changed type and default value */ constructor(indentChar?: IndentCharOption, indentSize?: number, newline?: NewlineOption); print(): string; /** * Returns the indent string for a given level. * @param level Indentation level */ private indent; /** * Appends a newline token to the given tokens array if newline is set, or adds an empty line if tokens is empty. * @param tokens Array of token objects with 'level' and 'text' property * @param level Indentation level */ appendNewline(level: number): void; /** * Appends text to the last element of tokens array. * @param tokens Array of token objects with 'text' property * @param text Text to append */ appendText(text: string): void; getCurrentLine(): PrintLine; } export declare class PrintLine { level: number; text: string; constructor(level: number, text: string); }