diff options
author | alexbiehl <alex.biehl@gmail.com> | 2017-12-17 11:50:27 +0100 |
---|---|---|
committer | Alexander Biehl <alexbiehl@gmail.com> | 2018-02-01 14:58:18 +0100 |
commit | ce30e3449f723cd1ba28d30455dd500e06397168 (patch) | |
tree | e0048ba1edbdbca5806986b24a707ec32cb772a3 /haddock-library/src/Documentation/Haddock | |
parent | 56c0e317093d2e25412cfa7dd10099c1fe729640 (diff) |
Remove scanner, takeWhile1_ already takes care of escaping
Diffstat (limited to 'haddock-library/src/Documentation/Haddock')
-rw-r--r-- | haddock-library/src/Documentation/Haddock/Parser.hs | 15 |
1 files changed, 1 insertions, 14 deletions
diff --git a/haddock-library/src/Documentation/Haddock/Parser.hs b/haddock-library/src/Documentation/Haddock/Parser.hs index dd1044cb..fcd26f83 100644 --- a/haddock-library/src/Documentation/Haddock/Parser.hs +++ b/haddock-library/src/Documentation/Haddock/Parser.hs @@ -338,7 +338,7 @@ definitionList :: BS.ByteString -> Parser (DocH mod Identifier) definitionList indent = DocDefList <$> p where p = do - label <- "[" *> (parseStringBS <$> scan False accept) <* ("]" <* optional ":") + label <- "[" *> (parseStringBS <$> takeWhile1_ (/= ']')) <* ("]" <* optional ":") c <- takeLine (cs, items) <- more indent p let contents = parseString . dropNLs . unlines $ c : cs @@ -346,19 +346,6 @@ definitionList indent = DocDefList <$> p Left x -> [(label, contents `docAppend` x)] Right i -> (label, contents) : i - -- handle '\]' escapes - accept True ']' = Just False - - -- stop on ']' or '\n' - accept _ ']' = Nothing - accept _ '\n' = Nothing - - -- starting an escape sequence - accept _ '\\' = Just True - - -- anything else - accept _ _ = Just False - -- | Drops all trailing newlines. dropNLs :: String -> String dropNLs = reverse . dropWhile (== '\n') . reverse |