parsec icon indicating copy to clipboard operation
parsec copied to clipboard

Documentation regarding updatePosChar does not match the function's behaviour

Open Pharap opened this issue 3 years ago • 0 comments

The documentation claims that:

If the character is a newline ('\n') or carriage return ('\r') the line number is incremented by 1.

(Specified here.)

But the actual definition does not do any special handling of '\r', thus leaving it to fall back to the default case behaviour of increasing the column number by 1.

https://github.com/haskell/parsec/blob/38dfc545874dd44c26382d8dd692eb533396c6f5/src/Text/Parsec/Pos.hs#L115-L120

I was initially going to submit a PR rectifying the comment (for which I prepared a commit), but I started wondering whether it's the comment that's wrong (i.e. that '\t' isn't supposed to behave that way) or the code itself (i.e. that '\t' should be specially handled and it isn't), so I decided to raise an issue first as a precaution.

Pharap avatar Mar 25 '21 01:03 Pharap