diff options
author | John MacFarlane <jgm@berkeley.edu> | 2017-08-09 21:15:54 -0700 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2017-08-09 21:16:17 -0700 |
commit | f4bff5d3599d0b6874c6b6604fb11016f8e038a9 (patch) | |
tree | 87145fdb1fd337b7efc20422a2a7b2051f577620 /src/Text/Pandoc/Readers | |
parent | 8c1ae7ddafc483d993d86161a93a1bf10d84f045 (diff) | |
download | pandoc-f4bff5d3599d0b6874c6b6604fb11016f8e038a9.tar.gz |
RST reader: reorganize block parsers for ~20% faster parsing.
Diffstat (limited to 'src/Text/Pandoc/Readers')
-rw-r--r-- | src/Text/Pandoc/Readers/RST.hs | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/Text/Pandoc/Readers/RST.hs b/src/Text/Pandoc/Readers/RST.hs index 02812dbd9..3b1eee010 100644 --- a/src/Text/Pandoc/Readers/RST.hs +++ b/src/Text/Pandoc/Readers/RST.hs @@ -215,10 +215,10 @@ block :: PandocMonad m => RSTParser m Blocks block = choice [ codeBlock , blockQuote , fieldList - , include , directive , anchor , comment + , include , header , hrule , lineBlock -- must go before definitionList @@ -352,7 +352,8 @@ singleHeader = do singleHeader' :: PandocMonad m => RSTParser m (Inlines, Char) singleHeader' = try $ do notFollowedBy' whitespace - txt <- trimInlines . mconcat <$> many1 (do {notFollowedBy blankline; inline}) + lookAhead $ anyLine >> oneOf underlineChars + txt <- trimInlines . mconcat <$> many1 (do {notFollowedBy newline; inline}) pos <- getPosition let len = (sourceColumn pos) - 1 blankline @@ -630,7 +631,7 @@ comment :: Monad m => RSTParser m Blocks comment = try $ do string ".." skipMany1 spaceChar <|> (() <$ lookAhead newline) - notFollowedBy' directiveLabel + -- notFollowedBy' directiveLabel -- comment comes after directive so unnec. manyTill anyChar blanklines optional indentedBlock return mempty |