/** * Table parser for box-drawing character tables. * * Detects and parses tables created with box-drawing characters * (├─│└┌) commonly found in CLI output. * * @module components/devenv/terminal/parsing/TableParser */ import type { IParsedLogEntry } from './LogParser.types'; /** * Box-drawing characters used for table borders. * Unicode range: U+2500-U+257F */ export declare const TABLE_CHARS: readonly ["─", "│", "┌", "┐", "└", "┘", "├", "┤", "┬", "┴", "┼", "═", "║", "╔", "╗", "╚", "╝", "╠", "╣", "╦", "╩", "╬", "╒", "╓", "╕", "╖", "╘", "╙", "╛", "╜", "╢", "╡", "╤", "╧", "╟", "╞", "╡", "╢", "╪", "╫"]; /** * Table row type. */ export type TTableRowType = 'top' | 'header' | 'separator' | 'data' | 'bottom' | 'unknown'; /** * Parsed table row. */ export interface ITableRow { /** Raw line */ raw: string; /** Row type */ type: TTableRowType; /** Cells extracted from the row (for data rows) */ cells?: string[]; /** Line number */ lineNumber: number; } /** * Parsed table data. */ export interface ITableData { /** All rows in the table */ rows: ITableRow[]; /** Number of columns */ columnCount: number; /** Header row if present */ headers?: string[]; /** Data rows (excluding borders) */ dataRows: string[][]; /** Line number of first row */ startLine: number; /** Line number of last row */ endLine: number; } /** * Table parser class. * * Detects and parses tables created with box-drawing characters. * Groups consecutive table lines and extracts cell data. * * @example * ```ts * const parser = new TableParser(); * const isTable = parser.isTableLine('├──────────┼──────────┤'); * const table = parser.parseTable(lines); * ``` */ export declare class TableParser { /** Minimum box-drawing characters to consider a line a table */ private readonly MIN_TABLE_CHARS; /** * Check if a line is a table line. * * A line is considered a table line if it contains multiple * box-drawing characters. * * @param line - Line to check * @returns true if line is part of a table */ isTableLine(line: string): boolean; /** * Determine the type of a table row. * * @param line - Table row line * @returns Row type */ getRowType(line: string): TTableRowType; /** * Extract cells from a table row. * * Splits the row by │ characters and trims each cell. * * @param line - Table row line * @returns Array of cell contents */ extractCells(line: string): string[]; /** * Parse a complete table from an array of lines. * * Groups consecutive table lines and extracts structured data. * * @param lines - Array of table lines * @param startLine - Starting line number * @returns Parsed table data */ parseTable(lines: string[], startLine: number): ITableData; /** * Parse table entries from a log stream. * * Scans through lines, grouping table lines into entries. * * @param lines - Array of log lines * @param startLine - Starting line number * @returns Array of parsed log entries */ parseTableEntries(lines: string[], startLine: number): IParsedLogEntry[]; /** * Get CSS class for a table row type. * * @param type - Row type * @returns CSS class string */ getRowClass(type: TTableRowType): string; } /** * Create a new table parser instance. * * @returns New TableParser instance */ export declare function createTableParser(): TableParser; //# sourceMappingURL=TableParser.d.ts.map