aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMateusz Kowalczyk <fuuzetsu@fuuzetsu.co.uk>2014-04-11 16:58:34 +0100
committerMateusz Kowalczyk <fuuzetsu@fuuzetsu.co.uk>2014-04-11 18:13:30 +0100
commitaf3b1444239027170f5e99a6dd67c1e2c6c44432 (patch)
tree2afa4e4bfafbe1c9492e5fd44e0969cac06e14b9 /src
parentb4210d41de296ee0f9d212e8d5b9fc186880a3e7 (diff)
Parse identifiers with ^ and ⋆ in them.
Fixes #298.
Diffstat (limited to 'src')
-rw-r--r--src/Haddock/Parser.hs10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/Haddock/Parser.hs b/src/Haddock/Parser.hs
index bd5cd200..ece9291f 100644
--- a/src/Haddock/Parser.hs
+++ b/src/Haddock/Parser.hs
@@ -419,13 +419,21 @@ autoUrl = mkLink <$> url
-- characters and does no actual validation itself.
parseValid :: Parser String
parseValid = do
- vs <- many' $ satisfy (`elem` "_.!#$%&*+/<=>?@\\|-~:") <|> digit <|> letter_ascii
+ vs' <- many' $ utf8String "⋆" <|> return <$> idChar
+ let vs = concat vs'
c <- peekChar
case c of
Just '`' -> return vs
Just '\'' -> (\x -> vs ++ "'" ++ x) <$> ("'" *> parseValid)
<|> return vs
_ -> fail "outofvalid"
+ where
+ idChar = satisfy (`elem` "_.!#$%&*+/<=>?@\\|-~:^")
+ <|> digit <|> letter_ascii
+
+-- | Parses UTF8 strings from ByteString streams.
+utf8String :: String -> Parser String
+utf8String x = decodeUtf8 <$> string (encodeUtf8 x)
-- | Parses identifiers with help of 'parseValid'. Asks GHC for 'RdrName' from the
-- string it deems valid.