summaryrefslogtreecommitdiffstats
path: root/regex.c
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2017-07-31 17:33:59 -0700
committerKaz Kylheku <kaz@kylheku.com>2017-07-31 17:40:55 -0700
commit0b38bc996c4c7e2693931bbd5103c7772b56b4bd (patch)
tree8e74fd6b7efc3a0fb87037b2bb58b9d8c6129339 /regex.c
parent2f5e7a5b96039b7a00543b4056bab7ec85c8db4b (diff)
downloadtxr-0b38bc996c4c7e2693931bbd5103c7772b56b4bd.tar.gz
txr-0b38bc996c4c7e2693931bbd5103c7772b56b4bd.tar.bz2
txr-0b38bc996c4c7e2693931bbd5103c7772b56b4bd.zip
txr-015 2009-10-15txr-015
Diffstat (limited to 'regex.c')
-rw-r--r--regex.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/regex.c b/regex.c
index a48b3ff5..51c95bc4 100644
--- a/regex.c
+++ b/regex.c
@@ -28,7 +28,10 @@
#include <stdlib.h>
#include <assert.h>
#include <dirent.h>
+#include <setjmp.h>
+#include <dirent.h>
#include "lib.h"
+#include "unwind.h"
#include "regex.h"
#define NFA_SET_SIZE 512
@@ -340,7 +343,7 @@ int nfa_all_states(nfa_state_t **inout, int num, int visited)
nfa_state_t *s = inout[i];
if (num >= NFA_SET_SIZE)
- abort();
+ internal_error("NFA set size exceeded");
switch (s->a.kind) {
case nfa_accept:
@@ -372,7 +375,7 @@ int nfa_all_states(nfa_state_t **inout, int num, int visited)
}
if (num > NFA_SET_SIZE)
- abort();
+ internal_error("NFA set size exceeded");
return num;
}
@@ -417,7 +420,7 @@ int nfa_closure(nfa_state_t **stack, nfa_state_t **in, int nin,
push them on the stack, and mark them as visited. */
for (i = 0; i < nin; i++) {
if (stackp >= NFA_SET_SIZE)
- abort();
+ internal_error("NFA set size exceeded");
in[i]->a.visited = visited;
stack[stackp++] = in[i];
out[nout++] = in[i];
@@ -429,7 +432,7 @@ int nfa_closure(nfa_state_t **stack, nfa_state_t **in, int nin,
nfa_state_t *top = stack[--stackp];
if (nout >= NFA_SET_SIZE)
- abort();
+ internal_error("NFA set size exceeded");
/* Only states of type nfa_empty are interesting.
Each such state at most two epsilon transitions. */
@@ -457,7 +460,7 @@ int nfa_closure(nfa_state_t **stack, nfa_state_t **in, int nin,
}
if (nout > NFA_SET_SIZE)
- abort();
+ internal_error("NFA set size exceeded");
return nout;
}
@@ -497,7 +500,7 @@ int nfa_move(nfa_state_t **in, int nin, nfa_state_t **out, int ch)
among a common set of leading struct members in the union. */
if (nmove >= NFA_SET_SIZE)
- abort();
+ internal_error("NFA set size exceeded");
out[nmove++] = s->o.trans;
}
@@ -580,7 +583,7 @@ static void regex_destroy(obj_t *regex)
}
static struct cobj_ops regex_obj_ops = {
- regex_equal, cobj_print_op, regex_destroy
+ regex_equal, cobj_print_op, regex_destroy, 0,
};
obj_t *regex_compile(obj_t *regex_sexp)