haskell / alex

A lexical analyser generator for Haskell
https://hackage.haskell.org/package/alex
BSD 3-Clause "New" or "Revised" License
298 stars 82 forks source link

Empty language crashes alex with (Array.!): undefined array element #164

Open andreasabel opened 4 years ago

andreasabel commented 4 years ago

Alex does not seem to handle the empty language well. MWE:

alex --version
echo ":- [] ;" > Test.x
alex Test.x

gives

Alex version 3.2.6, (c) 2003 Chris Dornan and Simon Marlow
alex: (Array.!): undefined array element

I think Alex should report a proper error, or find a way to handle the empty language (e.g. by ignoring it as it can never match anything).