diff options
Diffstat (limited to 'src/Haddock/Parser.hs')
-rw-r--r-- | src/Haddock/Parser.hs | 10 |
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. |