Declaration
Csv_Core :: struct {
source: Csv_Source;// where a chunk source's bytes go: made at the first refill, grown for a record that does not fit window: [] u8; eof: bool; options: Csv_Options; input: [] u8; position: int; offset: int; line: int = 1; line_start: int; previous_cr: bool; started: bool; header_ready: bool; header: [] string; header_index: Hash_Map.Map(string, int);// the document column of each struct member, in declaration order (-1: none) columns: [..] int;// columns is filled bound: bool;// owns the storage below, whichever allocator a later call runs under allocator: Allocator; width: int = -1; buffer: [..] u8; cells: [..] Csv_Cell; fields: [..] string; stops: [256] u8; marks: Csv_Marks;// the window offset of the 64-byte block the two masks describe (-1: none) block_base: int = -1;// bit i: byte block_base + i ends a run in an unquoted field block_unquoted: u64;// the same for a quoted field block_quoted: u64;// the fields of the current record the block scanner decoded into buffer decoded: [..] Csv_Decoded;// read every record byte by byte; the tests use it as the reference for the block scanner bytewise: bool;// the source failed while the block scanner was refilling: fill_to reports it source_failed: bool; error: Csv_Error; record_offset: int; record_line: int; record_line_start: int;// where the record began in the window record_position: int;// the block scanner read it, so cells is empty and field_position finds the fields record_scanned: bool;}The parser state every reader shares: the input window, the position, the header and the column mapping. Csv_Reader wraps it; the fields are internal.