Re: [Haskell-cafe] Parsec line number off-by-one

2011-09-21 Thread Roman Cheplyaka
Hi Ben, This is indeed a bug in parsec. I have written a patch that fixes this. Currently Antoine Latter (current parsec's maintainer) and I are working on getting these patches into the next parsec release. As a workaround until then, you can apply the attached patch manually. darcs get

Re: [Haskell-cafe] Parsec line number off-by-one

2011-09-21 Thread Christian Maeder
Hi, 1. your lookAhead is unnecessary, because your items (atomNames) never start with %. 2. your try fails in (line 12, column 1), because the last item (aka atomName) starts consuming \n, before your eol parser is called. So rather than calling spaces before every real atom, I would call

Re: [Haskell-cafe] Parsec line number off-by-one

2011-09-21 Thread Ben Gamari
On Wed, 21 Sep 2011 11:27:31 +0200, Christian Maeder christian.mae...@dfki.de wrote: Hi, 1. your lookAhead is unnecessary, because your items (atomNames) never start with %. I see. 2. your try fails in (line 12, column 1), because the last item (aka atomName) starts consuming \n,

Re: [Haskell-cafe] Parsec line number off-by-one

2011-09-21 Thread Ben Gamari
On Wed, 21 Sep 2011 09:37:40 +0300, Roman Cheplyaka r...@ro-che.info wrote: Hi Ben, This is indeed a bug in parsec. Ahh good. I'm glad I'm not crazy. Given that it seems the lookahead is actually unnecessary, looks like I can skip the patch too. Thanks for your reply! Cheers, - Ben

[Haskell-cafe] Parsec line number off-by-one

2011-09-20 Thread Ben Gamari
Recently I've been playing around with Parsec for a simple parsing project. While I was able to quickly construct my grammar (simplified version attached), getting it working has been a bit tricky. In particular, I am now stuck trying to figure out why Parsec is mis-reporting line numbers. Parsec