code wiki / _hdl_build / nx_galx_shell_jslint.nx

nx_galx_shell_jslint.nx

buildroot/runtime/_hdl_build/nx_galx_shell_jslint.nx

8356 B192 linesdepth 2pulls 2 transitivereach 2 importersview sourcekind librarytopic galx
docsdependenciesstructsconstsfunctions

about

nx_galx_shell_jslint.nx -- SOVEREIGN JS syntax sanity guard for the gallery shell's inline <script>. WHY: the gallery JS broke (operator: "its not working", browser: "Uncaught SyntaxError: Invalid or unexpected token") because an HTML attribute with single quotes (href='#') was embedded inside a single-quoted JS string (lb.innerHTML='...href='#'...') -> the string terminated early and the '#' was a stray token. There is NO JS engine in this sovereign environment, so nothing caught it. This is a tiny string state-machine that catches exactly that class (premature string termination -> stray token after a string) plus unbalanced strings/ brackets. NOT a full JS parser -- a focused, no-false-positive guard for hand-written shell JS. LIMITATION (documented): regex literals are treated as division; this is balance-neutral and produces no false positive for regexes without embedded quotes (the gallery's only regex is /[<&>]/g). A regex literal containing a quote would need real regex handling -- add it the day the shell needs one. license_tier: ORIGINAL

dependencies 1 imports · 2 importers

nx_syscalls.nx nx_galx_shell_jslint.nx nx_gallery_serve.nx nx_galx_shell_jslint_gate.nx

imports: nx_syscalls.nx

imported by: nx_gallery_serve.nxnx_galx_shell_jslint_gate.nx

structs

none

consts

15const K_MAGIC_2048: i64 = 2048

functions

19func jslint_scan_script(s: *u8, n: i64) -> i64
called by 3: mainlint_litmain
94func jslint_find_script(html: *u8, n: i64, out_start: *i64) -> i64
called by 2: mainmain
121func shell_complete(html: *u8, n: i64) -> i64
called by 2: mainmain
167func shell_style_balanced(html: *u8, n: i64) -> i64
called by 2: mainmain