git.iko.soy/typeable/pandoc
on master help sign in
Parsing: in nonspaceChar use satisfy instead of oneOf.

For efficiency.

commitf2749ba6cd0ec2473332394bfbb6f479b667f35c authorJohn MacFarlane <jgm@berkeley.edu> dateMon 7 Dec 2020, 12:56 (6 years ago) parent501ea7f
1 file changed+7−1
src/Text/Pandoc/Parsing.hs+7−1
src/Text/Pandoc/Parsing.hs+7−1
@@ -443,7 +443,13 @@ spaceChar = satisfy $ \c -> c == ' ' || c == '\t'
443443
444444-- | Parses a nonspace, nonnewline character.
445445nonspaceChar :: Stream s m Char => ParserT s st m Char
446−nonspaceChar = noneOf ['\t', '\n', ' ', '\r']
446+nonspaceChar = satisfy (not . isSpaceChar)
447+ where
448+ isSpaceChar ' ' = True
449+ isSpaceChar '\t' = True
450+ isSpaceChar '\n' = True
451+ isSpaceChar '\r' = True
452+ isSpaceChar _ = False
447453
448454-- | Skips zero or more spaces or tabs.
449455skipSpaces :: Stream s m Char => ParserT s st m ()