summaryrefslogtreecommitdiffstats
path: root/buf.c
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2017-09-12 20:08:12 -0700
committerKaz Kylheku <kaz@kylheku.com>2017-09-12 20:08:12 -0700
commit1d1a1c61329de3fc0400306d13de0377ff5e316c (patch)
tree78eb8c4a3da6ef50140c24a64979a0f05d3394d6 /buf.c
parent7345dcd449cfdcf7d4d5ab438ea755f5252f50a1 (diff)
downloadtxr-1d1a1c61329de3fc0400306d13de0377ff5e316c.tar.gz
txr-1d1a1c61329de3fc0400306d13de0377ff5e316c.tar.bz2
txr-1d1a1c61329de3fc0400306d13de0377ff5e316c.zip
regex: eliminate nfa_accept state type.
Acceptance states are instead represented by adding an accept flag to nfa_empty states. This will support an optimization which eliminates accept states that are referenced only by empty states. * regex.c (nfa_kind_t): Enum member nfa_accept removed. (struct nfa_state_accept): Renamed to nfa_state_any. (struct nfa_state_empty): New member, accept. (union nfa_state): Member a changes from struct nfa_state_accept to struct nfa_state_any. (nfa_accept_state_p): New macro. (nfa_state_accept): Now makes an nfe_empty type state, with no transitions out and the accept flag set. (nfa_state_empty): Initialize accept flag to zero. (nfa_state_empty_convert): Set the accept flag to zero. (nfa_state_merge): Use new macro in assertion. (nfa_map_states): Remove nfa_accept switch case. (nfa_thread_epsilons): We must not eliminate an empty state which is an acceptance state, even if it meets the other conditions. (nfa_closure): Use a local variable to eliminate repetition of set[i] expression. Test for accept state using new macro. (nfa_move_closure): Test for accept state using new macro.
Diffstat (limited to 'buf.c')
0 files changed, 0 insertions, 0 deletions