code wiki / _hdl_build / nx_regex_vm_lib.nx

nx_regex_vm_lib.nx

buildroot/runtime/_hdl_build/nx_regex_vm_lib.nx

9222 B128 linesdepth 2pulls 2 transitivereach 1 importersview sourcekind librarytopic regex
docsdependenciesstructsconstsfunctions

about

nx_regex_vm_lib.nx -- the UNIFIED sovereign regex engine (linear-time Thompson NFA, ReDoS-immune) as a pure LIBRARY. STRICT SUPERSET of the old atom-NFA (nx_regex_lib): literal / '.' / '*' '+' '?' / '[..]' classes+ranges / '\' escape + ALTERNATION '|' + GROUPS '()' + '^' '$' ANCHORS (line-anchor semantics, as grep uses). No backtracking => ReDoS- IMMUNE (the RE2/Go design). This is the ONE regex engine for the OS; grep (re_vm_grep_count) runs on it. No main.

dependencies 1 imports · 1 importers

nx_syscalls.nx nx_regex_vm_lib.nx nx_regex_unified_gate.nx

imports: nx_syscalls.nx

imported by: nx_regex_unified_gate.nx

structs

none

consts

6const K_MAGIC_1024: i64 = 1024

functions

8func rv_slen(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} return n }
called by 1: re_vm_run
9func cs_set(csbm: *i64, base: i64, ch: i64) -> i64 { csbm[base+(ch>>6)]=csbm[base+(ch>>6)]|(1<<(ch&63)); return 0 }
called by 1: re2post
10func cs_match(csbm: *i64, cls: i64, ch: i64) -> i64 { return (csbm[cls*4+(ch>>6)]>>(ch&63))&1 }
called by 1: re_vm_run
13func re2post(re: *u8, pop: *i64, parg: *i64, csbm: *i64, pcsn: *i64) -> i64
called by 1: re_vm_run calls 2: sys_mmapcs_set
44func post2nfa(pop: *i64, parg: *i64, np: i64, scls: *i64, sto: *i64, se1: *i64, se2: *i64, pns: *i64, pmatch: *i64) -> i64
called by 1: re_vm_run calls 1: sys_mmap
74func addstate(scls: *i64, sto: *i64, se1: *i64, se2: *i64, s: i64, clist: *i64, cnp: *i64, seen: *i64, gen: i64, mst: i64, mf: *i64) -> i64
called by 2: addstatere_vm_run calls 1: addstate
86func re_vm_run(re: *u8, text: *u8, tn: i64) -> i64
120func re_vm_grep_count(buf: *u8, nbuf: i64, pat: *u8) -> i64
called by 1: main calls 1: re_vm_run
128func regex_vm_lib_main() -> i64 { return 0 }