nx_value_parse_json.nx
buildroot/runtime/nx_value_parse_json.nx
about
nx_value_parse_json.nx -- bytes -> NxValue tree (DOM, not stream).
module: nishi-core.data.value_parse_json
depends: nishi-core.io.syscalls, nishi-core.data.value
disk_kb: 6
capability: CORE_IO
wired_status: FULLY_WIRED
license_tier: PUBLIC_NISHI_SUBSTRATE
genealogy_id: rfc_8259_json_data_interchange +
recursive_descent_parser_tradition +
nishi_build_the_system_cardinal_2026
Brick #2 of the bits-up ingestion stack. Reads RFC 8259 JSON
bytes and produces an NxValue tree. No upstream-source-specific
knowledge -- the tree carries WHATEVER the JSON said.
Inline lexer (does not import nx_json) to keep the all-syscalls.nx
import topology that lets us compose against nx_dir for batch
ingestion later. Same SAX semantics as nx_json but emits NxValue
nodes directly.
String content: span includes raw bytes between quotes; common
escapes (\n \t \\ \" \/) are decoded inline; \uXXXX is NOT
decoded (substrate works with raw UTF-8 in most cases; a future
nx_value_decode_unicode pass can add that).
Numbers: integers parsed as i64; floats parsed lossy to Q10
fixed-point (substrate convention). Caller can re-parse from
str_ptr/str_len if precision matters.
Recursion: bounded NX_VAL_PARSE_MAX_DEPTH per JPL Rule 2.
dependencies 2 imports · 2 importers
imports: syscalls.nxnx_value.nx
imported by: nx_ingest_batch.nxnx_value_parse_json_test.nx
structs
| 64 | struct NxValParse |
consts
| 39 | const NX_VAL_PARSE_OK: i64 = 1 |
| 40 | const NX_VAL_PARSE_BAD_TOKEN: i64 = 2 |
| 41 | const NX_VAL_PARSE_UNTERMINATED: i64 = 3 |
| 42 | const NX_VAL_PARSE_DEPTH_EXCEEDED: i64 = 4 |
| 43 | const NX_VAL_PARSE_EXPECTED_COLON: i64 = 5 |
| 44 | const NX_VAL_PARSE_EXPECTED_RBRACE: i64 = 6 |
| 45 | const NX_VAL_PARSE_EXPECTED_RBRACKET: i64 = 7 |
| 46 | const NX_VAL_PARSE_EOF_EARLY: i64 = 8 |
| 47 | const NX_VAL_PARSE_BAD_ARGS: i64 = 9 |
| 73 | const NX_VAL_PARSE_BYTES: i64 = 48 |
| 74 | const NX_VAL_PARSE_MAX_DEPTH: i64 = 64 |
| 81 | const NX_VAL_PARSE_DEFAULT_MAX_ITEMS: i64 = 4096 |
functions
| 49 | func nx_val_parse_verdict_name(v: i64) -> *u8 |
| 85 | func nx_val_parse_is_ws(c: i64) -> i64 called by 1: nx_val_parse_skip_ws |
| 93 | func nx_val_parse_skip_ws(p: *NxValParse) |
| 115 | func nx_val_parse_is_digit(c: i64) -> i64 |
| 121 | func nx_val_parse_number(p: *NxValParse) -> *NxValue called by 1: nx_val_parse_value calls 3: nx_val_parse_is_digitnx_value_new_intnx_value_new_float_q10 |
| 228 | func nx_val_parse_string(p: *NxValParse) -> *NxValue |
| 267 | func nx_val_parse_match_lit(p: *NxValParse, lit: *u8, n: i64) -> i64 called by 1: nx_val_parse_value |
| 283 | func nx_val_parse_value(p: *NxValParse) -> *NxValue |
| 446 | func nx_value_parse_json( |