/** * CSV Parse State * * Defines the ParseState type and factory function for creating * mutable parsing state. Also includes field building operations. */ import type { HeaderArray } from "../types.js"; import type { ParseConfig } from "./config.js"; /** * Mutable parsing state - shared between sync and streaming parsers */ export interface ParseState { lineNumber: number; dataRowCount: number; skippedDataRows: number; truncated: boolean; headerRow: HeaderArray | null; originalHeaders: HeaderArray | null; useHeaders: boolean; headerRowProcessed: boolean; renamedHeadersForMeta: Record | null; currentRowStartLine: number; currentRowStartOffset: number; /** Quoted status per field. May be a shared readonly array - copy before modifying. */ currentRowQuoted: readonly boolean[]; currentRawRow: string; } /** * Create initial parse state with optional header configuration */ export declare function createParseState(config: Pick): ParseState; /** * Reset info state for next row */ export declare function resetInfoState(state: ParseState, trackInfo: boolean, trackRaw: boolean, nextLine: number, nextOffset: number): void; /** * Get a shared array of false values for unquoted field tracking. * Returns a frozen shared reference for common cases to avoid per-row allocation. * * IMPORTANT: The returned array must NOT be modified. If you need to store * the values, make a copy: `[...getUnquotedArray(n)]` or `.slice(0, n)`. * * @param length - Number of fields in the row * @returns Shared frozen array (for length <= 256) or new array (for larger rows) */ export declare function getUnquotedArray(length: number): readonly boolean[];