[automaton] loop all the way through 9, whoops #2225

This commit is contained in:
nick black 2021-10-02 23:03:51 -04:00
parent c5cf67e5f1
commit f3c18b3279
No known key found for this signature in database
GPG Key ID: 5F43400C21CBFACC

View File

@ -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);