Fix bug in construct_nfa

Intermediate final states were being left in by add_fsa(); we always
want to mark the added FSA's final state as non-final.
This commit is contained in:
2024-11-02 21:54:30 +00:00
parent 074b174d0f
commit 34fee99232
3 changed files with 62 additions and 0 deletions

View File

@@ -25,6 +25,9 @@ static void add_fsa(fsa_t *f, const fsa_t *o, int *init_out, int *final_out)
}
memcpy(f->states + f->count, o->states, o->count * sizeof(fsa_state_t));
// Mark o's final state as non-final.
f->states[f->count].final = false;
// Retarget the rules of the copied states to refer to the new
// state indices.
for (int i = f->count; i < count; ++i) {