From ffd0e8028f15f3616f1b3eaaf98459c0c75c6313 Mon Sep 17 00:00:00 2001 From: Ɓukasz Hanuszczak Date: Fri, 5 Jun 2015 14:56:59 +0200 Subject: Fix comment recognition in Haskell source parser. --- haddock-api/src/Haddock/Backends/Hyperlinker/Parser.hs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'haddock-api/src/Haddock') diff --git a/haddock-api/src/Haddock/Backends/Hyperlinker/Parser.hs b/haddock-api/src/Haddock/Backends/Hyperlinker/Parser.hs index 9d58728f..29edb4c3 100644 --- a/haddock-api/src/Haddock/Backends/Hyperlinker/Parser.hs +++ b/haddock-api/src/Haddock/Backends/Hyperlinker/Parser.hs @@ -90,6 +90,9 @@ tokenize = } classify :: String -> TokenType +classify str + | "--" `isPrefixOf` str = TkComment + | "{-" `isPrefixOf` str = TkComment classify (c:_) | isSpace c = TkSpace | isDigit c = TkNumber @@ -101,8 +104,6 @@ classify str | str `elem` keywords = TkKeyword | str `elem` glyphs = TkGlyph | all (`elem` symbols) str = TkOperator - | "--" `isPrefixOf` str = TkComment - | "{-" `isPrefixOf` str = TkComment | isIdentifier str = TkIdentifier | otherwise = TkUnknown -- cgit v1.2.3