code wiki / _hdl_build / nx_dom_tokenize.nx

nx_dom_tokenize.nx

buildroot/runtime/_hdl_build/nx_dom_tokenize.nx

7337 B146 linesdepth 2pulls 2 transitivereach 0 importersview sourcekind tooltopic dom
docsdependenciesstructsconstsfunctions

about

nx_dom_tokenize.nx -- DOM TOKENIZER rung 1: the foundation for true layout-aware quality criteria (contrast, focus order, overlap, responsive behavior all need STRUCTURE, not byte offsets). Parses HTML into a flat ELEMENT TABLE, stride 5: {kind 0=open 1=close 2=self/void, name_off, pos, depth, name_len}; names in a pool. Handles void elements (img/br/input/meta/link/hr), skips comments and attribute text. Gates on the REAL artifact: (a) tag balance -- every open has a close, final depth 0; (b) counts agree with the quality gate's independent byte-scan (nav/main/footer/h1); (c) max depth sane (<32). The element table is what rung-2 criteria walk. license_tier: ORIGINAL

dependencies 1 imports · 0 importers

nx_syscalls.nx nx_dom_tokenize.nx

imports: nx_syscalls.nx

imported by: nobody (leaf or entry point)

call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown

main _p sys_write sys_mmap sys_openat_rd sys_exit sys_read sys_close dt_tokenize dt_isalpha dt_lower dt_isvoid _pn sys_mmap ↻ sys_write ↻ dt_count_named

structs

none

consts

9const K_MAGIC_4194320: i64 = 4194320
10const K_MAGIC_2097152: i64 = 2097152
11const K_MAGIC_1048576: i64 = 1048576
12const K_MAGIC_262144: i64 = 262144
13const K_MAGIC_20000: i64 = 20000

functions

14func _p(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); return 0 }
called by 1: main calls 1: sys_write
15func _pn(v: i64) -> i64 { let bb: *u8=sys_mmap(28); var m: i64=v; if m<0{m=0-m;sys_write(1,"-" as *u8,1)}; let t: *u8=sys_mmap(28); var k: i64=0; if m==0{t[0]=48;k=1}; while m>0{t[k]=48+(m%10);m=m/10;k=k+1}; var i: i64=0; while i<k{bb[i]=t[k-1-i];i=i+1}; sys_write(1,bb,k); return 0 }
called by 1: main calls 2: sys_mmapsys_write
16func dt_isalpha(c: i64) -> i64 { if c >= 97 { if c <= 122 { return 1 } } if c >= 65 { if c <= 90 { return 1 } } return 0 }
called by 1: dt_tokenize
17func dt_lower(c: i64) -> i64 { if c >= 65 { if c <= 90 { return c + 32 } } return c }
called by 1: dt_tokenize
19func dt_isvoid(pool: *u8, off: i64, len: i64) -> i64
called by 1: dt_tokenize
30func dt_tokenize(buf: *u8, n: i64, elems: *i64, maxel: i64, pool: *u8, state: *i64) -> i64
called by 1: main calls 3: dt_isalphadt_lowerdt_isvoid
88func dt_count_named(elems: *i64, ne: i64, pool: *u8, name: *u8, kind: i64) -> i64
called by 1: main
105func main() -> i64