[commit: haddock] master: Fix identifier recognition in Haskell source parser. (01a2e7c)

git at git.haskell.org git at git.haskell.org
Wed Jul 8 08:39:28 UTC 2015


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

On branch  : master
Link       : http://git.haskell.org/haddock.git/commitdiff/01a2e7c5ab873c0041624a6ec0b0a54eb7da60cc

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

commit 01a2e7c5ab873c0041624a6ec0b0a54eb7da60cc
Author: Łukasz Hanuszczak <lukasz.hanuszczak at gmail.com>
Date:   Fri Jun 5 14:39:28 2015 +0200

    Fix identifier recognition in Haskell source parser.


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

01a2e7c5ab873c0041624a6ec0b0a54eb7da60cc
 haddock-api/src/Haddock/Backends/Hyperlinker/Parser.hs | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/haddock-api/src/Haddock/Backends/Hyperlinker/Parser.hs b/haddock-api/src/Haddock/Backends/Hyperlinker/Parser.hs
index 7a162f6..9d58728 100644
--- a/haddock-api/src/Haddock/Backends/Hyperlinker/Parser.hs
+++ b/haddock-api/src/Haddock/Backends/Hyperlinker/Parser.hs
@@ -163,6 +163,9 @@ symbols :: [Char]
 symbols = "!#$%&*+./<=>?@\\^|-~:"
 
 isIdentifier :: String -> Bool
-isIdentifier (c:str)
-    | isLetter c = all (\c' -> isAlphaNum c' || c == '\'') str
+isIdentifier (s:str)
+    | (isLower' s || isUpper s) && all isAlphaNum' str = True
+  where
+    isLower' c = isLower c || c == '_'
+    isAlphaNum' c = isAlphaNum c || c == '_' || c == '\''
 isIdentifier _ = False



More information about the ghc-commits mailing list