katef/libfsm

We accidentally lost the ability to detect ambiguities

katef opened this issue · 4 comments

katef commented

This should error:

; echo '/ab?c/ -> $t1; /abc/ -> $t2;' | ./build/bin/lx > /dev/null
; 

The error code is still there (calling fsm_example), but it's never reached.

Equivalent stuff in re(1), I'm suspicious about using just one element from the array in find_first_match_for_end_state(), rather than checking them all:

    return find_match_with_id(end_id_buf[0]);

Do you have an example input & set of CLI flags handy for re? Otherwise I'll figure it out later.

katef commented

An equivalent case for re, -u should report the ambiguities
image

On da28efb (the #439 branch) this appears to be working as expected:

$ echo '/abc*/ -> $t1; /abc/ -> $t2;' | build/bin/lx -ldot | todot
ambiguous mappings to $t1, $t2; for example on input 'abc'

out

Am I missing something?

Oh I think fsm_example() is broken.