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.
|
updatePosChar :: SourcePos -> Char -> SourcePos |
|
updatePosChar (SourcePos name line column) c |
|
= case c of |
|
'\n' -> SourcePos name (line+1) 1 |
|
'\t' -> SourcePos name line (column + 8 - ((column-1) `mod` 8)) |
|
_ -> SourcePos name line (column + 1) |
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.
The documentation claims that:
(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.parsec/src/Text/Parsec/Pos.hs
Lines 115 to 120 in 38dfc54
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.