davidbien / lexang

Lexical Analyzer Generator Template Library
Boost Software License 1.0
0 stars 0 forks source link

Look at the use of multimap<> in _dfa::CompressTransitions #14

Closed davidbien closed 3 years ago

davidbien commented 3 years ago

If I look in the debugger the ordering of the data is suspect. I see no issues but it seems a different data structure might be best instead of multimap<> as is - may need to just change the operator <() usage to some other comparator.

davidbien commented 3 years ago

Ok, so I slayed that one pretty quick. I used the global pair less than operator - er std namespace pair less than. And rid the multimap in favor of a map since now all keys will be unique. Good fix. There really couldn't have been a bug associated with this since it would always create a compressed transition, it just might not find the old one that already existed - i.e. we could have two of the same things in the map. The way things work this couldn't cause a bug in the output DFA, we would just be slightly less efficient about it - because we might have two (or more) of the same keys in the map - mapping essentially to the same value.