code wiki / (root) / nx_regex_lib.nx

nx_regex_lib.nx

buildroot/runtime/nx_regex_lib.nx

4507 B91 linesdepth 2pulls 2 transitivereach 4 importersview sourcekind librarytopic regex
docsdependenciesstructsconstsfunctions

about

nx_regex_lib.nx -- GENERAL SOVEREIGN REGEX CAPABILITY (shared library). Linear-time NFA matcher (state-set, no backtracking => ReDoS-IMMUNE, the RE2/Go design). Pure library: no main, no UI. Imports only nx_syscalls. Subset: literal, '.', '*' '+' '?', '[..]' classes (a-z ranges), '^' '$' anchors. (alternation |/groups () = TODO.) re_parse(pat,bm,q,fl)->natom re_match(text,tn,bm,q,na,fl,steps)->0/1 re_search(pat,text,tn)->0/1 re_run(pat,text,steps)->0/1

dependencies 1 imports · 2 importers

nx_syscalls.nx nx_regex_lib.nx nx_regex.nx nx_shell_lib.nx

imports: nx_syscalls.nx

imported by: nx_regex.nxnx_shell_lib.nx

structs

none

consts

none

functions

7func re_slen(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} return n }
called by 1: re_run
8func re_setbit(bm: *i64, base: i64, ch: i64) -> i64 { let w: i64=base+(ch>>6); bm[w]=bm[w]|(1<<(ch&63)); return 0 }
called by 1: re_parse
9func re_getbit(bm: *i64, base: i64, ch: i64) -> i64 { return (bm[base+(ch>>6)]>>(ch&63))&1 }
called by 1: re_match
13func re_parse(pat: *u8, bm: *i64, q: *i64, fl: *i64) -> i64
called by 2: re_searchre_run calls 1: re_setbit
51func re_close(set: *i64, q: *i64, na: i64) -> i64
called by 1: re_match
60func re_match(text: *u8, tn: i64, bm: *i64, q: *i64, na: i64, fl: *i64, steps: *i64) -> i64
87func re_run(pat: *u8, text: *u8, steps: *i64) -> i64