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

Ben Gamari bgamari.foss at gmail.com
Wed Sep 21 14:31:40 CEST 2011


On Wed, 21 Sep 2011 11:27:31 +0200, Christian Maeder <Christian.Maeder at 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", before your eol parser is called.
> 
Ahh, this is a good point. I for some reason seeded the thought in my
mind that spaces takes the ' ' character, not '\n'.

> So rather than calling spaces before every real atom, I would call it 
> after every real atom and after your formatDecl (so before your linesOf 
> parser).
> 
Excellent solution. I appreciate your help. That would have taken me
quite a bit of head-banging to find.

Cheers,

- Ben



More information about the Haskell-Cafe mailing list