Markdown reader: More efficient version of scanForPipe.

This commit is contained in:
John MacFarlane
2013-01-25 16:13:58 -08:00
parent 4c74b7aaab
commit f7ecbd03d4
+5 -1
View File
@@ -1186,7 +1186,11 @@ pipeTableHeaderPart = do
-- Succeed only if current line contains a pipe.
scanForPipe :: Parser [Char] st ()
scanForPipe = lookAhead (manyTill (satisfy (/='\n')) (char '|')) >> return ()
scanForPipe = do
inp <- getInput
case break (\c -> c == '\n' || c == '|') inp of
(_,'|':_) -> return ()
_ -> mzero
-- | Parse a table using 'headerParser', 'rowParser',
-- 'lineParser', and 'footerParser'. Variant of the version in