nx_value_parse_csv.nx
buildroot/runtime/nx_value_parse_csv.nx
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
imports: syscalls.nxnx_value.nx
imported by: nx_ingest_batch.nxnx_value_parse_csv_test.nx
structs
| 58 | struct NxCsvOpts |
| 86 | struct NxCsvParse |
consts
| 39 | const NX_CSV_OK: i64 = 1 |
| 40 | const NX_CSV_BAD_ARGS: i64 = 2 |
| 41 | const NX_CSV_NO_HEADER: i64 = 3 |
| 42 | const NX_CSV_TOO_MANY_FIELDS: i64 = 4 |
| 43 | const NX_CSV_UNTERMINATED_QTE: i64 = 5 |
| 44 | const NX_CSV_MAX_ROWS_HIT: i64 = 6 // not an error -- truncated |
| 66 | const NX_CSV_OPTS_BYTES: i64 = 40 |
| 98 | const NX_CSV_PARSE_BYTES: i64 = 56 |
| 134 | const NX_CSV_END_DELIMITER: i64 = 1 |
| 135 | const NX_CSV_END_LINE: i64 = 2 |
| 136 | const NX_CSV_END_INPUT: i64 = 3 |
functions
| 46 | func nx_csv_verdict_name(v: i64) -> *u8 |
| 68 | func nx_csv_opts_default(out: *NxCsvOpts) called by 1: nx_value_parse_csv |
| 76 | func nx_csv_opts_tsv(out: *NxCsvOpts) |
| 102 | func nx_csv_skip_bom(p: *NxCsvParse) called by 1: nx_value_parse_csv |
| 128 | func nx_csv_is_line_break(c: i64) -> i64 |
| 138 | func nx_csv_read_field( |
| 289 | func nx_csv_read_row( |
| 328 | func nx_value_parse_csv( |