code wiki / (root) / nx_value_parse_csv.nx

nx_value_parse_csv.nx

buildroot/runtime/nx_value_parse_csv.nx

18418 B513 linesdepth 4pulls 4 transitivereach 4 importersview sourcekind librarytopic value
docsdependenciesstructsconstsfunctions

about

nx_value_parse_csv.nx -- bytes -> NxValue (ARRAY of OBJECTs). module: nishi-core.data.value_parse_csv depends: nishi-core.io.syscalls, nishi-core.data.value disk_kb: 5 capability: CORE_IO wired_status: FULLY_WIRED license_tier: PUBLIC_NISHI_SUBSTRATE genealogy_id: rfc_4180_csv_canonical + postel_robustness_principle + nishi_build_the_system_cardinal_2026 Brick #2b of the bits-up ingestion stack. Parallel to nx_value_parse_json but for delimiter-separated values. Input: CSV/TSV bytes (RFC 4180-ish; tolerant to BOM, CRLF/LF, and unterminated final row). Output: NxValue of kind ARRAY whose items are OBJECTs. Each OBJECT's keys come from the header row; each OBJECT's values are STRING (typing happens later). Configurable via NxCsvOpts: delimiter: byte; default 0x2C (',') -- pass 0x09 ('\t') for TSV quote_char: byte; default 0x22 ('"'); 0 to disable quote handling has_header: 1 = first row is field names (default) 0 = synthesize "col_0","col_1",... keys max_rows: hard cap on data rows parsed (per JPL Rule 2) Composition: nx_ingest_batch reads bytes, hands to either nx_value_parse_json OR nx_value_parse_csv based on extension -- same downstream NxValue tree, same flat emit.

dependencies 2 imports · 2 importers

syscalls.nx nx_value.nx nx_value_parse_csv.nx nx_ingest_batch.nx nx_value_parse_csv_test.nx

imports: syscalls.nxnx_value.nx

imported by: nx_ingest_batch.nxnx_value_parse_csv_test.nx

structs

58struct NxCsvOpts
86struct NxCsvParse

consts

39const NX_CSV_OK: i64 = 1
40const NX_CSV_BAD_ARGS: i64 = 2
41const NX_CSV_NO_HEADER: i64 = 3
42const NX_CSV_TOO_MANY_FIELDS: i64 = 4
43const NX_CSV_UNTERMINATED_QTE: i64 = 5
44const NX_CSV_MAX_ROWS_HIT: i64 = 6 // not an error -- truncated
66const NX_CSV_OPTS_BYTES: i64 = 40
98const NX_CSV_PARSE_BYTES: i64 = 56
134const NX_CSV_END_DELIMITER: i64 = 1
135const NX_CSV_END_LINE: i64 = 2
136const NX_CSV_END_INPUT: i64 = 3

functions

46func nx_csv_verdict_name(v: i64) -> *u8
68func nx_csv_opts_default(out: *NxCsvOpts)
called by 1: nx_value_parse_csv
76func nx_csv_opts_tsv(out: *NxCsvOpts)
102func nx_csv_skip_bom(p: *NxCsvParse)
called by 1: nx_value_parse_csv
128func nx_csv_is_line_break(c: i64) -> i64
138func nx_csv_read_field(
289func nx_csv_read_row(
328func nx_value_parse_csv(