code wiki / (root) / nx_value_parse_json.nx

nx_value_parse_json.nx

buildroot/runtime/nx_value_parse_json.nx

16093 B468 linesdepth 4pulls 4 transitivereach 4 importersview sourcekind librarytopic value
docsdependenciesstructsconstsfunctions

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

syscalls.nx nx_value.nx nx_value_parse_json.nx nx_ingest_batch.nx nx_value_parse_json_test.nx

imports: syscalls.nxnx_value.nx

imported by: nx_ingest_batch.nxnx_value_parse_json_test.nx

structs

64struct NxValParse

consts

39const NX_VAL_PARSE_OK: i64 = 1
40const NX_VAL_PARSE_BAD_TOKEN: i64 = 2
41const NX_VAL_PARSE_UNTERMINATED: i64 = 3
42const NX_VAL_PARSE_DEPTH_EXCEEDED: i64 = 4
43const NX_VAL_PARSE_EXPECTED_COLON: i64 = 5
44const NX_VAL_PARSE_EXPECTED_RBRACE: i64 = 6
45const NX_VAL_PARSE_EXPECTED_RBRACKET: i64 = 7
46const NX_VAL_PARSE_EOF_EARLY: i64 = 8
47const NX_VAL_PARSE_BAD_ARGS: i64 = 9
73const NX_VAL_PARSE_BYTES: i64 = 48
74const NX_VAL_PARSE_MAX_DEPTH: i64 = 64
81const NX_VAL_PARSE_DEFAULT_MAX_ITEMS: i64 = 4096

functions

49func nx_val_parse_verdict_name(v: i64) -> *u8
85func nx_val_parse_is_ws(c: i64) -> i64
93func nx_val_parse_skip_ws(p: *NxValParse)
115func nx_val_parse_is_digit(c: i64) -> i64
121func nx_val_parse_number(p: *NxValParse) -> *NxValue
228func nx_val_parse_string(p: *NxValParse) -> *NxValue
267func nx_val_parse_match_lit(p: *NxValParse, lit: *u8, n: i64) -> i64
called by 1: nx_val_parse_value
283func nx_val_parse_value(p: *NxValParse) -> *NxValue
446func nx_value_parse_json(