On 27/11/09 16:56, Ian Lynagh wrote:
On Fri, Nov 27, 2009 at 04:11:43PM +0000, Simon Marlow wrote:
On 27/11/2009 15:00, Ian Lynagh wrote:

of modules, but then fails due to SrcLoc's thinking tabs are 1 character
wide), and then we can look at tweaking the rule.

SrcLocs think tabs are 1 character wide?  But surely our error messages
are column-accurate normally, so how can this be?

Probably because we normally don't use tabs  :-)

$ printf 'foo = 11\t\t\t\tmodule'>  q.hs
# That's 8 characters then 3 tabs then the module keyword
$ ghc -c q.hs
q.hs:1:12: parse error on input `module'

I have vague memories that it was done this way on purpose. After all, we have to calculate the real column offset (including 8-column tabs) for implementing the layout rule, so there would be no good reason not to use those column numbers in SrcLocs too. In fact, I think we did it this way because originally we wanted column-accurate SrcLocs for Visual Studio, which also counted tabs as 1 char.

So, I think we could fix this now. It would probably let us clean up Lexer.x a bit too, there's probably some duplication between the SrcLoc and the column offsets being carried around in the monad.

Cheers,
        Simon

_______________________________________________
Cvs-ghc mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/cvs-ghc

Reply via email to