[commit: haddock] master: Fix comment recognition in Haskell source parser. (ffd0e80)
git at git.haskell.org
git at git.haskell.org
Wed Jul 8 08:40:09 UTC 2015
Repository : ssh://git@git.haskell.org/haddock
On branch : master
Link : http://git.haskell.org/haddock.git/commitdiff/ffd0e8028f15f3616f1b3eaaf98459c0c75c6313
>---------------------------------------------------------------
commit ffd0e8028f15f3616f1b3eaaf98459c0c75c6313
Author: Łukasz Hanuszczak <lukasz.hanuszczak at gmail.com>
Date: Fri Jun 5 14:56:59 2015 +0200
Fix comment recognition in Haskell source parser.
>---------------------------------------------------------------
ffd0e8028f15f3616f1b3eaaf98459c0c75c6313
haddock-api/src/Haddock/Backends/Hyperlinker/Parser.hs | 5 +++--
1 file 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 9d58728..29edb4c 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
More information about the ghc-commits
mailing list