aboutsummaryrefslogtreecommitdiff
path: root/haddock-api/src/Haddock
diff options
context:
space:
mode:
authorŁukasz Hanuszczak <lukasz.hanuszczak@gmail.com>2015-06-05 14:56:59 +0200
committerŁukasz Hanuszczak <lukasz.hanuszczak@gmail.com>2015-06-30 22:37:48 +0200
commitffd0e8028f15f3616f1b3eaaf98459c0c75c6313 (patch)
tree97a426a8f27ce9acdd57e02668fda864fb72ebbf /haddock-api/src/Haddock
parent01a2e7c5ab873c0041624a6ec0b0a54eb7da60cc (diff)
Fix comment recognition in Haskell source parser.
Diffstat (limited to 'haddock-api/src/Haddock')
-rw-r--r--haddock-api/src/Haddock/Backends/Hyperlinker/Parser.hs5
1 files changed, 3 insertions, 2 deletions
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