From 45cc27fe79492a7b921574796a7ea8fdac4c5af2 Mon Sep 17 00:00:00 2001 From: Ɓukasz Hanuszczak Date: Thu, 18 Jun 2015 14:29:59 +0200 Subject: Fix issues with escaped newlines in comments. --- haddock-api/src/Haddock/Backends/Hyperlinker/Parser.hs | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) (limited to 'haddock-api') diff --git a/haddock-api/src/Haddock/Backends/Hyperlinker/Parser.hs b/haddock-api/src/Haddock/Backends/Hyperlinker/Parser.hs index bfee4a7f..fa5a58b3 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 = -- cgit v1.2.3