* Matthias Hörmann <mhoermann@gmail.com> [2012-05-30 21:36:13+0200]
And my question about this is made up of two parts
1. Why doesn't it print my "unexpected" message but instead says unknown parse error 2. Why is the location in the text off (I would expect it to fail at column 6 (first character beyond the result it could return) or 7 (first character that makes the string no prefix of any acceptable string)
Thanks for reporting. This is a regression introduced by me in this patch: Sun Feb 20 18:24:22 EET 2011 Roman Cheplyaka <roma@ro-che.info> * Choose the longest match when merging error messages The source of the regression is that parsec sometimes generates dummy (aka "unknown") error messages when no actual error has occurred. In your case the dummy error has a "bigger" position because it was generated by anyChar inside lookAhead. So, when merging errors, before simply looking at the positions we should check if one of them is dummy and just ignore it. The patch is attached. With this patch your code prints: parse error at (line 1, column 7): unexpected "Hallofb", expecting one of ["Hello","Hallo","Foo","HallofFame"] This is probably still somewhat confusing to a user of your code (there's no "Hallofb" starting at column 7), but is correct from Parsec's point of view, because you generated this message while looking at the 7th character. -- Roman I. Cheplyaka :: http://ro-che.info/