commit - 433a5f454f2c22d5c78edda09ff911bd778640ff
commit + 1ffbb49cc704cab9fe4226cc3e2ea0f95cb1b4e3
blob - 04799503c1900e853577c30ac417803b7d9b3b05
blob + 271ffcea40c0d6daeceae6d7df3da694ff0a19d2
--- nfa.c
+++ nfa.c
return -1; /* no output possible */
}
+/*
+ * run the automaton for one iteration, either consuming input, generating
+ * output or failing.
+ *
+ * returns the number of input characters consumed or -1 if stuck.
+ */
static int
nfastep(struct prep *pr, int x, struct set *act, struct set *next)
{
blob - 85ba26fc94f7829119ff875aa8325b4204a629cd
blob + 34a70ddea66684a948f180773f4061be2d0cf89c
--- nfa.h
+++ nfa.h
/* running NFAs */
-typedef int sub_t(int symbol, size_t state, int, void *env);
-typedef int out_t(struct range r, size_t state, int, void *env);
+typedef int sub_t(int symbol, size_t state, int pos, void *env);
+typedef int out_t(struct range r, size_t state, int pos, void *env);
struct prep;
struct prep *nfaprep(NFA, sub_t *, out_t *, void *);
int nfacont(struct prep *, const char *, size_t);
int nfaend(struct prep *);
+/* convenience wrapper combining nfaprep, nfarun, and nfaend */
int nfamatch(NFA, sub_t *, out_t *, void *, const char *, size_t);