nx_bright_reasoned_import_gate.nx
buildroot/runtime/nx_bright_reasoned_import_gate.nx
about
nx_bright_reasoned_import_gate.nx -- GATE for nx_bright_reasoned_import (the referee-replay importer), driven
IN-PROCESS on a fixture tree under /tmp: a three-pair JSON whose key carries an escaped newline and whose value
carries an escaped quote, an escaped backslash, a two-byte \u escape, a surrogate-pair \u escape and an escaped
tab; a biology queries.tsv whose second row ends in CRLF; an economics queries.tsv whose only row has no rewrite
(the neg-control). Every expected byte string is BUILT at run time from named pieces and byte constants, so no
tooth depends on the lexer's escape contract. Proves: both walk passes agree on the pair count, the decoded key
equals the prep organ's flattened cell, the decoded value carries the exact UTF-8 bytes, reason and concat rows
are byte-exact, a CRLF row still matches, staging is idempotent, a BOM is skipped, an unmatched row is COUNTED
and the ONE decision function refuses it, an unreadable split refuses, a truncated object is malformed, and the
split table is nx_beir_eval's. license_tier: ORIGINAL No hw writes (Rule 26).
dependencies 3 imports · 0 importers
imports: nx_syscalls.nxnx_gate_verdict.nxnx_bright_reasoned_import.nx
imported by: nobody (leaf or entry point)
call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown
structs
| none |
consts
| 15 | const X_ROOT: *u8 = "/tmp/nx_bright_reasoned_import_gate" |
| 16 | const X_BRIGHT: *u8 = "/tmp/nx_bright_reasoned_import_gate/bright" |
| 17 | const X_D_BIO: *u8 = "/tmp/nx_bright_reasoned_import_gate/bright/biology" |
| 18 | const X_D_ECON: *u8 = "/tmp/nx_bright_reasoned_import_gate/bright/economics" |
| 19 | const X_Q_BIO: *u8 = "/tmp/nx_bright_reasoned_import_gate/bright/biology/queries.tsv" |
| 20 | const X_Q_ECON: *u8 = "/tmp/nx_bright_reasoned_import_gate/bright/economics/queries.tsv" |
| 21 | const X_JSON: *u8 = "/tmp/nx_bright_reasoned_import_gate/reasoned.json" |
| 22 | const X_JSON_BOM: *u8 = "/tmp/nx_bright_reasoned_import_gate/reasoned_bom.json" |
| 23 | const X_JSON_CUT: *u8 = "/tmp/nx_bright_reasoned_import_gate/reasoned_cut.json" |
| 24 | const X_OUT_REASON: *u8 = "queries.fx_reason.tsv" |
| 25 | const X_OUT_CONCAT: *u8 = "queries.fx_concat.tsv" |
| 26 | const X_TMP_REASON: *u8 = "/tmp/nx_bright_reasoned_import_gate/bright/biology/queries.fx_reason.tsv.tmp" |
| 27 | const X_TMP_CONCAT: *u8 = "/tmp/nx_bright_reasoned_import_gate/bright/biology/queries.fx_concat.tsv.tmp" |
| 28 | const X_TMP_REASON2: *u8 = "/tmp/nx_bright_reasoned_import_gate/bright/biology/queries.fx_reason2.tsv.tmp" |
| 29 | const X_OUT_REASON2: *u8 = "queries.fx_reason2.tsv" |
| 30 | const X_MODE_DIR: i64 = 0x1ed |
| 31 | const X_CELL: i64 = 8 |
| 32 | const X_CAP: i64 = 4096 |
| 33 | const X_PAIRS: i64 = 3 |
| 34 | const X_BOM_0: i64 = 0xEF |
| 35 | const X_BOM_1: i64 = 0xBB |
| 36 | const X_BOM_2: i64 = 0xBF |
| 37 | const X_E_ACUTE_0: i64 = 0xC3 |
| 38 | const X_E_ACUTE_1: i64 = 0xA9 |
| 39 | const X_SMILE_0: i64 = 0xF0 |
| 40 | const X_SMILE_1: i64 = 0x9F |
| 41 | const X_SMILE_2: i64 = 0x98 |
| 42 | const X_SMILE_3: i64 = 0x80 |
| 44 | const X_W_ALPHA: *u8 = "alpha" |
| 45 | const X_W_BETA: *u8 = "beta" |
| 46 | const X_W_GAMMA: *u8 = "gamma" |
| 47 | const X_W_DELTA: *u8 = "delta" |
| 48 | const X_W_SECOND: *u8 = "second" |
| 49 | const X_W_UNUSED: *u8 = "unused" |
| 50 | const X_W_V: *u8 = "v" |
| 51 | const X_W_1: *u8 = "1" |
| 52 | const X_W_TAIL: *u8 = "tail" |
| 53 | const X_W_NOPE: *u8 = "nope" |
| 54 | const X_W_ID0: *u8 = "0" |
| 55 | const X_W_ID1: *u8 = "1" |
| 56 | const X_H_E9: *u8 = "00e9" |
| 57 | const X_H_D83D: *u8 = "d83d" |
| 58 | const X_H_DE00: *u8 = "de00" |
| 59 | const X_W_N: *u8 = "n" |
| 60 | const X_W_T: *u8 = "t" |
| 61 | const X_W_U: *u8 = "u" |
| 62 | const X_SPLIT0: *u8 = "biology" |
| 63 | const X_SPLIT11: *u8 = "theoremqa_theorems" |
functions
| 65 | func x_slen(s: *u8) -> i64 { var n: i64 = 0; while ((s[n] as i64) & RI_BYTE) != 0 { n = n + 1 } return n } |
| 66 | func x_cat(dst: *u8, off: i64, s: *u8) -> i64 { let n: i64 = x_slen(s); var i: i64 = 0; while i < n { dst[off + i] = s[i]; i = i + 1 } dst[off + n] = 0 as u8; return off + n } called by 8: x_escx_expect_value_ax_expect_key_ax_build_jsonx_build_q_biox_build_q_econ+2 calls 1: x_slen |
| 67 | func x_catb(dst: *u8, off: i64, b: i64) -> i64 { dst[off] = b as u8; dst[off + 1] = 0 as u8; return off + 1 } |
| 69 | func x_esc(dst: *u8, off: i64, s: *u8) -> i64 { var o: i64 = x_catb(dst, off, RI_BACKSLASH); return x_cat(dst, o, s) } |
| 70 | func x_write(path: *u8, buf: *u8, n: i64) -> i64 |
| 78 | func x_read(path: *u8, lenp: *i64) -> *u8 { lenp[0] = 0; return sys_read_file(path, lenp) } |
| 79 | func x_bytes_eq(a: *u8, an: i64, b: *u8, bn: i64) -> i64 { if an != bn { return 0 } return ri_memeq(a, b, an) } |
| 80 | func x_file_eq(path: *u8, want: *u8, wn: i64) -> i64 |
| 87 | func x_expect_value_a(dst: *u8) -> i64 |
| 104 | func x_expect_key_a(dst: *u8) -> i64 { var o: i64 = x_cat(dst, 0, X_W_ALPHA); o = x_catb(dst, o, RI_SPACE); return x_cat(dst, o, X_W_BETA) } |
| 106 | func x_build_json(dst: *u8, bom: i64) -> i64 |
| 127 | func x_build_q_bio(dst: *u8) -> i64 |
| 132 | func x_build_q_econ(dst: *u8) -> i64 { var o: i64 = x_cat(dst, 0, X_W_ID0); o = x_catb(dst, o, RI_TAB); o = x_cat(dst, o, X_W_NOPE); return x_catb(dst, o, RI_NL) } |
| 134 | func x_expect_reason(dst: *u8, va: *u8, val: i64) -> i64 |
| 140 | func x_expect_concat(dst: *u8, va: *u8, val: i64) -> i64 |
| 146 | func x_decode(path: *u8, out: *i64) -> i64 |
| 175 | func main() -> i64 |