diff options
author | John MacFarlane <fiddlosopher@gmail.com> | 2013-01-25 18:42:40 -0800 |
---|---|---|
committer | John MacFarlane <fiddlosopher@gmail.com> | 2013-01-25 18:42:40 -0800 |
commit | 846be80c268697a3ee07a292db6dd78208aaabe2 (patch) | |
tree | adc6a4f1380dcc7ce6d50c46f635d02346918631 /src/Text/Pandoc/Readers | |
parent | 71c5ebe682f09d11739e46ac734347c69f3b00fb (diff) | |
download | pandoc-846be80c268697a3ee07a292db6dd78208aaabe2.tar.gz |
Markdown reader: Performance improvement in str parser.
Moved a guardEnabled out of an inner loop.
Diffstat (limited to 'src/Text/Pandoc/Readers')
-rw-r--r-- | src/Text/Pandoc/Readers/Markdown.hs | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/Text/Pandoc/Readers/Markdown.hs b/src/Text/Pandoc/Readers/Markdown.hs index 235b594db..558043b3c 100644 --- a/src/Text/Pandoc/Readers/Markdown.hs +++ b/src/Text/Pandoc/Readers/Markdown.hs @@ -1422,11 +1422,14 @@ nonEndline = satisfy (/='\n') str :: MarkdownParser (F Inlines) str = do - isSmart <- readerSmart . stateOptions <$> getState + isSmart <- getOption readerSmart + intrawordUnderscores <- option False $ + True <$ guardEnabled Ext_intraword_underscores a <- alphaNum as <- many $ alphaNum - <|> (guardEnabled Ext_intraword_underscores >> - try (char '_' >>~ lookAhead alphaNum)) + <|> (if intrawordUnderscores + then try (char '_' >>~ lookAhead alphaNum) + else mzero) <|> if isSmart then (try $ satisfy (\c -> c == '\'' || c == '\x2019') >> lookAhead alphaNum >> return '\x2019') |