diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2015-09-15 00:32:23 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2015-09-15 00:32:23 -0700 |
commit | 943b5baa2d54fc1cc90758429c8a69c288f70868 (patch) | |
tree | a47c713a890830f942703ecfe35ca1e7901c1e3b /regex.h | |
parent | 55207f2ce58d2ecde6a3274147d3162c987cb510 (diff) | |
download | txr-943b5baa2d54fc1cc90758429c8a69c288f70868.tar.gz txr-943b5baa2d54fc1cc90758429c8a69c288f70868.tar.bz2 txr-943b5baa2d54fc1cc90758429c8a69c288f70868.zip |
Remove limit on NFA state size and allocate tightly.
* regex.c (struct regex): New member, nstates.
(NFA_SET_SIZE): Preprocessor symbol removed.
(struct nfa_machine): New member, nstates.
(nfa_all_states): Function removed.
(nfa_map_states): New static function.
(nfa_count_one, nfa_count_states, nfa_collect_one): New static
functions.
(nfa_free): Takes nstates argument. Calculate array of all
states using nfa_map_states over nfa_collect_one rather than
nfa_all_states. The array is tightly allocated. Also the
spanning tree traversal needs just one root, nfa.start.
It's not clear why nfa_all_states used nfa.start and
nfa.accept as roots.
(nfa_closure): Takes nstates parameter; array bounds checking
performed tightly against nstates rather than NFA_SET_SIZE.
(nfa_move): Check against NFA_SET_SIZE removed.
(nfa_run): Take nstates argument. Allocate arrays tightly. Pass nstates
to nfa_closure.
(regex_destroy): Pass regex->nstates to nfa_free.
(regex_compile): Initialize regex->nstates.
(regex_run): Pass regex->nstates to nfa_run.
(regex_machine_reset): Pass nstates to nfa_closure.
(regex_machine_init): Initialize n.nstates member of regex
machine. Allocate arrays tightly.
(regex_machine_feed): Pass nstates to nfa_closure.
Diffstat (limited to 'regex.h')
0 files changed, 0 insertions, 0 deletions