katef / libfsm

DFA regular expression library & friends
BSD 2-Clause "Simplified" License
931 stars 52 forks source link

Re-instate detecting ambiguous mappings in lx. #439

Open silentbicycle opened 1 year ago

silentbicycle commented 1 year ago

Previously the conflicts were flagged inside of carryopaque, but that was removed in 3d532eef. Now do it in its own pass, called ast_noteconflicts.

Add a test (tests/lxconflict/in0.lx and out0.err).

This fixes the lx side of #438.

katef commented 1 year ago

Hm I think something is amiss here, but I can't work out what. image

Here I think $t1 shouldn't be matched by "b", and therefore that the example for this is wrong:

ambiguous mappings to $t1, $t2; for example on input 'b'

doing the same with re(1) (note -b) gives the end labels I'd expect: image

So is lx propogating these endids too enthusiastically between states somehow?

katef commented 1 year ago

Confirming that the above bug doesn't exist on the current main (which is of course the point of #438): image

silentbicycle commented 10 months ago

Hm I think something is amiss here, but I can't work out what.

Your re command line has a?b?c whereas your lx commands a?b?c? (note the trailing ?) so that's an extra difference.

There's clearly something wrong here ($t1 shouldn't match "bc"), but that's a thing to keep in mind with the example above.