From f4b727487a65e6b611bbaafbd2207bd63a8df706 Mon Sep 17 00:00:00 2001 From: Simon Marlow Date: Thu, 10 Dec 2009 16:09:09 +0000 Subject: Fix #3741, simplifying things in the process The problem in #3741 was that we had confused column numbers with byte offsets, which fails in the case of UTF-8 (amongst other things). Fortunately we're tracking correct column offsets now, so we didn't have to make a calculation based on a byte offset. I got rid of two fields from the PState (last_line_len and last_offs).and one field from the AI (alex input) constructor. --- compiler/cmm/CmmLex.x | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'compiler/cmm') diff --git a/compiler/cmm/CmmLex.x b/compiler/cmm/CmmLex.x index bfc18c1844..42243258c5 100644 --- a/compiler/cmm/CmmLex.x +++ b/compiler/cmm/CmmLex.x @@ -300,7 +300,7 @@ lexToken = do sc <- getLexState case alexScan inp sc of AlexEOF -> do let span = mkSrcSpan loc1 loc1 - setLastToken span 0 0 + setLastToken span 0 return (L span CmmT_EOF) AlexError (loc2,_) -> do failLocMsgP loc1 loc2 "lexical error" AlexSkip inp2 _ -> do @@ -309,7 +309,7 @@ lexToken = do AlexToken inp2@(end,buf2) len t -> do setInput inp2 let span = mkSrcSpan loc1 end - span `seq` setLastToken span len len + span `seq` setLastToken span len t span buf len -- ----------------------------------------------------------------------------- -- cgit v1.2.1