Markdown reader: Performance improvement in str parser.
Moved a guardEnabled out of an inner loop.
This commit is contained in:
parent
71c5ebe682
commit
846be80c26
1 changed files with 6 additions and 3 deletions
|
@ -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')
|
||||
|
|
Loading…
Add table
Reference in a new issue