From f3c18b3279b8525097e59896fd1aab29feff5436 Mon Sep 17 00:00:00 2001 From: nick black Date: Sat, 2 Oct 2021 23:03:51 -0400 Subject: [PATCH] [automaton] loop all the way through 9, whoops #2225 --- src/lib/automaton.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/lib/automaton.c b/src/lib/automaton.c index a062aad83..1b4707723 100644 --- a/src/lib/automaton.c +++ b/src/lib/automaton.c @@ -232,7 +232,7 @@ get_phi_node(automaton* a, esctrie* e){ return NULL; } targ->ntype = NODE_NUMERIC; - for(int i = '0' ; i < '9' ; ++i){ + for(int i = '0' ; i <= '9' ; ++i){ targ->trie[i] = esctrie_idx(a, targ); } } @@ -281,7 +281,7 @@ static inline void add_phi_and_eta_recurse(automaton* a, esctrie* e, const char* prefix, int pfxlen, esctrie* phi, unsigned follow, esctrie* eta){ - //logtrace("working with %u %d prefix [%*.*s]\n", esctrie_idx(a, e), pfxlen, pfxlen, pfxlen, prefix); +//logtrace("working with %u %d prefix [%*.*s]\n", esctrie_idx(a, e), pfxlen, pfxlen, pfxlen, prefix); // if pfxlen == 0, we found a match for our fixed prefix. start adding phi // links whereever we can. where we find chained numerics, add an eta link. if(pfxlen == 0){ @@ -517,7 +517,8 @@ int walk_automaton(automaton* a, struct inputctx* ictx, unsigned candidate, return 1; } } - loginfo("unexpected transition %u\n", candidate); + loginfo("unexpected transition on %u[%u]\n", + esctrie_idx(a, e), candidate); return -1; } e = esctrie_from_idx(a, a->state);