code wiki / _hdl_build / nx_regex_vm_lib.nx
nx_regex_vm_lib.nx
buildroot/runtime/_hdl_build/nx_regex_vm_lib.nx
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
imports: nx_syscalls.nx
imported by: nx_regex_unified_gate.nx
structs
| none |
consts
| 6 | const K_MAGIC_1024: i64 = 1024 |
functions
| 8 | func 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 |
| 9 | func 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 |
| 10 | func cs_match(csbm: *i64, cls: i64, ch: i64) -> i64 { return (csbm[cls*4+(ch>>6)]>>(ch&63))&1 } called by 1: re_vm_run |
| 13 | func re2post(re: *u8, pop: *i64, parg: *i64, csbm: *i64, pcsn: *i64) -> i64 |
| 44 | func post2nfa(pop: *i64, parg: *i64, np: i64, scls: *i64, sto: *i64, se1: *i64, se2: *i64, pns: *i64, pmatch: *i64) -> i64 |
| 74 | func addstate(scls: *i64, sto: *i64, se1: *i64, se2: *i64, s: i64, clist: *i64, cnp: *i64, seen: *i64, gen: i64, mst: i64, mf: *i64) -> i64 |
| 86 | func re_vm_run(re: *u8, text: *u8, tn: i64) -> i64 |
| 120 | func re_vm_grep_count(buf: *u8, nbuf: i64, pat: *u8) -> i64 |
| 128 | func regex_vm_lib_main() -> i64 { return 0 } |