haskell / alex

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

Two single quotes in input produce hard-to-debug error message #110

Closed sergv closed 7 years ago

sergv commented 7 years ago

I accidentally named my variable foo'' and got really confusing error message which was quite a challenge to figure out in a big file.

Input, TestTwoSingleQuotes.x:

%wrapper "basic"

$digit = 0-9

tokens :-
  $digit+ ;

{

main :: IO ()
main = foo''

}

Output:

$ alex TestTwoSingleQuotes.x
TestTwoSingleQuotes.x:25:1: lexical error in code fragment at end of file
sergv commented 7 years ago

Fixed by #111.