code wiki / (root) / nx_yaml_subset.nx

nx_yaml_subset.nx

buildroot/runtime/nx_yaml_subset.nx

10619 B331 linesdepth 3pulls 3 transitivereach 2 importersview sourcekind library
docsdependenciesstructsconstsfunctions

about

nx_yaml_subset.nx -- bits-up YAML subset parser. Mirrors the YAML subset that nishi-pages/build/build.py accepted: key: value (string) key: 123 (int) key: -42 (signed int) key: 2026-05-19 (ISO date, kept as string) key: true (bool, kept as string "1" / "0") key: "quoted value" (strips outer quotes) key: 'quoted' (same, single) key: [a, b, c] (flow list of strings) # comment lines (ignored) <blank line> (ignored) Used by: - nishi-pages site.yaml + per-doc frontmatter - bench/ops scripts that read config Per cardinal feedback-bits-up-exceed-never-match: substrate-owned; no libyaml, no Python's yaml.safe_load, no PyYAML. Parser is deterministic + bounded + auditable. Per cardinal feedback-defensive-at-boundaries-trusting-internally: input bytes are validated (key chars only [A-Za-z0-9_-]), value bytes are stored verbatim (NUL-terminated) into a caller-owned arena.

dependencies 1 imports · 2 importers

nx_syscalls_x86_64.nx nx_yaml_subset.nx nx_build_doc.nx nx_build_site.nx

imports: nx_syscalls_x86_64.nx

imported by: nx_build_doc.nxnx_build_site.nx

structs

54struct NxYamlEntry
63struct NxYamlDoc

consts

39const NX_YAML_OK: i64 = 0
40const NX_YAML_BAD_INPUT: i64 = 1 // src null or len <= 0
41const NX_YAML_BAD_LINE: i64 = 2 // no colon in non-empty/non-comment line
42const NX_YAML_TOO_MANY_KEYS: i64 = 3 // exceeded max_entries
43const NX_YAML_ARENA_FULL: i64 = 4 // value arena cap exhausted
44const NX_YAML_KEY_TOO_LONG: i64 = 5
46const NX_YAML_MAX_KEY_LEN: i64 = 64
61const NX_YAML_ENTRY_BYTES: i64 = 32
75const NX_YAML_DOC_BYTES: i64 = 72

functions

79func nx_yaml_doc_init(d: *NxYamlDoc,
97func _yml_is_ws(b: i64) -> i64
called by 1: _yml_ltrim
103func _yml_is_key_char(b: i64) -> i64
called by 1: nx_yaml_parse
113func _yml_eol(src: *u8, end: i64, off: i64) -> i64
called by 1: nx_yaml_parse
123func _yml_ltrim(src: *u8, end: i64, off: i64) -> i64
called by 1: nx_yaml_parse calls 1: _yml_is_ws
133func _yml_rtrim(src: *u8, start: i64, line_end: i64) -> i64
called by 1: nx_yaml_parse
149func _yml_strip_quotes(src: *u8, off_io: *i64, len_io: *i64) -> i64
called by 1: nx_yaml_parse
174func _yml_append(dst: *u8, used_io: *i64, cap: i64,
called by 1: nx_yaml_parse
189func nx_yaml_parse(d: *NxYamlDoc, src: *u8, src_n: i64) -> i64
280func nx_yaml_lookup(d: *NxYamlDoc,
306func nx_yaml_count(d: *NxYamlDoc) -> i64
313func nx_yaml_key_at(d: *NxYamlDoc, i: i64,
323func nx_yaml_value_at(d: *NxYamlDoc, i: i64,