code wiki / _hdl_build / nx_galx_shell_jslint.nx
nx_galx_shell_jslint.nx
buildroot/runtime/_hdl_build/nx_galx_shell_jslint.nx
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
imports: nx_syscalls.nx
imported by: nx_gallery_serve.nxnx_galx_shell_jslint_gate.nx
structs
| none |
consts
| 15 | const K_MAGIC_2048: i64 = 2048 |
functions
| 19 | func jslint_scan_script(s: *u8, n: i64) -> i64 |
| 94 | func jslint_find_script(html: *u8, n: i64, out_start: *i64) -> i64 |
| 121 | func shell_complete(html: *u8, n: i64) -> i64 |
| 167 | func shell_style_balanced(html: *u8, n: i64) -> i64 |