[commit: haddock] master: Fix issues with escaped newlines in comments. (45cc27f)

git at git.haskell.org git at git.haskell.org
Wed Jul 8 08:40:48 UTC 2015


Repository : ssh://git@git.haskell.org/haddock

On branch  : master
Link       : http://git.haskell.org/haddock.git/commitdiff/45cc27fe79492a7b921574796a7ea8fdac4c5af2

>---------------------------------------------------------------

commit 45cc27fe79492a7b921574796a7ea8fdac4c5af2
Author: Łukasz Hanuszczak <lukasz.hanuszczak at gmail.com>
Date:   Thu Jun 18 14:29:59 2015 +0200

    Fix issues with escaped newlines in comments.


>---------------------------------------------------------------

45cc27fe79492a7b921574796a7ea8fdac4c5af2
 haddock-api/src/Haddock/Backends/Hyperlinker/Parser.hs | 13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)

diff --git a/haddock-api/src/Haddock/Backends/Hyperlinker/Parser.hs b/haddock-api/src/Haddock/Backends/Hyperlinker/Parser.hs
index bfee4a7..fa5a58b 100644
--- a/haddock-api/src/Haddock/Backends/Hyperlinker/Parser.hs
+++ b/haddock-api/src/Haddock/Backends/Hyperlinker/Parser.hs
@@ -82,14 +82,11 @@ tag :: [String] -> [(Span, String)]
 tag =
     reverse . snd . foldl aux (Position 1 1, [])
   where
-    aux (pos, cs) c =
-        let pos' = move pos c
-        in (pos', ((Span pos pos', c):cs))
-    move pos str@(c:_)
-        | isSpace c = foldl move' pos str
-    move pos str = pos { posCol = posCol pos + length str }
-    move' pos '\n' = pos { posRow = posRow pos + 1, posCol = 1 }
-    move' pos _ = pos { posCol = posCol pos + 1 }
+    aux (pos, cs) str =
+        let pos' = foldl move pos str
+        in (pos', (Span pos pos', str):cs)
+    move pos '\n' = pos { posRow = posRow pos + 1, posCol = 1 }
+    move pos _ = pos { posCol = posCol pos + 1 }
 
 tokenize :: [(Span, String)] -> [Token]
 tokenize =



More information about the ghc-commits mailing list