git.iko.soy/typeable/pandoc
on master help sign in
Removed followedBy' parser from Text/ParserCombinators/Pandoc,
ae19b94fiddlosopher
src/Text/Pandoc/Readers/LaTeX.hs+1−1
@@ -322,7 +322,7 @@ itemBlock = try (do
322--
322--
323
323
324specialEnvironment = do -- these are always parsed as raw
324specialEnvironment = do -- these are always parsed as raw
325− followedBy' (choice (map (\name -> begin name) ["tabular", "figure",
325+ lookAhead (choice (map (\name -> begin name) ["tabular", "figure",
326 "tabbing", "eqnarry", "picture", "table", "verse", "theorem"]))
326 "tabbing", "eqnarry", "picture", "table", "verse", "theorem"]))
327 rawLaTeXEnvironment
327 rawLaTeXEnvironment
328
328
src/Text/Pandoc/Readers/Markdown.hs+5−5
@@ -394,7 +394,7 @@ rawListItem start = try (do
394-- or (in compact lists) endline.
394-- or (in compact lists) endline.
395-- note: nested lists are parsed as continuations
395-- note: nested lists are parsed as continuations
396listContinuation start = try (do
396listContinuation start = try (do
397− followedBy' indentSpaces
397+ lookAhead indentSpaces
398 result <- many1 (listContinuationLine start)
398 result <- many1 (listContinuationLine start)
399 blanks <- many blankline
399 blanks <- many blankline
400 return ((concat result) ++ blanks))
400 return ((concat result) ++ blanks))
@@ -443,10 +443,10 @@ para = try (do
443 newline
443 newline
444 st <- getState
444 st <- getState
445 if stateStrict st
445 if stateStrict st
446− then choice [followedBy' blockQuote, followedBy' header,
446+ then choice [lookAhead blockQuote, lookAhead header,
447− (do{blanklines; return ()})]
447+ (do{blanklines; return Null})]
448− else choice [followedBy' emacsBoxQuote,
448+ else choice [(do{lookAhead emacsBoxQuote; return Null}),
449− (do{blanklines; return ()})]
449+ (do{blanklines; return Null})]
450 let result' = normalizeSpaces result
450 let result' = normalizeSpaces result
451 return (Para result'))
451 return (Para result'))
452
452
src/Text/Pandoc/Readers/RST.hs+2−2
@@ -198,7 +198,7 @@ codeBlockStart = try (do
198-- paragraph that ends in a :: starting a code block
198-- paragraph that ends in a :: starting a code block
199paraBeforeCodeBlock = try (do
199paraBeforeCodeBlock = try (do
200 result <- many1 (do {notFollowedBy' codeBlockStart; inline})
200 result <- many1 (do {notFollowedBy' codeBlockStart; inline})
201− followedBy' (string "::")
201+ lookAhead (string "::")
202 return (Para (if (last result == Space)
202 return (Para (if (last result == Space)
203 then normalizeSpaces result
203 then normalizeSpaces result
204 else (normalizeSpaces result) ++ [Str ":"])))
204 else (normalizeSpaces result) ++ [Str ":"])))
@@ -446,7 +446,7 @@ listItem start = try (do
446 rest <- many (listContinuation markerLength)
446 rest <- many (listContinuation markerLength)
447 blanks <- choice [ try (do
447 blanks <- choice [ try (do
448 b <- many blankline
448 b <- many blankline
449− followedBy' start
449+ lookAhead start
450 return b),
450 return b),
451 many1 blankline ] -- whole list must end with blank
451 many1 blankline ] -- whole list must end with blank
452 -- parsing with ListItemState forces markers at beginning of lines to
452 -- parsing with ListItemState forces markers at beginning of lines to
src/Text/ParserCombinators/Pandoc.hs−10
@@ -30,7 +30,6 @@ Special parser combinators for Pandoc readers.
30module Text.ParserCombinators.Pandoc (
30module Text.ParserCombinators.Pandoc (
31 anyLine,
31 anyLine,
32 many1Till,
32 many1Till,
33− followedBy',
34 notFollowedBy',
33 notFollowedBy',
35 oneOfStrings,
34 oneOfStrings,
36 spaceChar,
35 spaceChar,
@@ -119,15 +118,6 @@ notFollowedBy' :: Show b => GenParser a st b -> GenParser a st ()
119notFollowedBy' parser = try (do { c <- try parser; unexpected (show c) }
118notFollowedBy' parser = try (do { c <- try parser; unexpected (show c) }
120 <|> return ())
119 <|> return ())
121
120
122−-- | The inverse of @notFollowedBy'@. Fails if parser will fail, otherwise
123−-- returns @()@ (but does not consume any input).
124−followedBy' :: (Show b) => GenParser a st b -> GenParser a st ()
125−followedBy' parser = do
126− isNotFollowed <- option False (do{ notFollowedBy' parser; return True})
127− if isNotFollowed
128− then fail "not followed by parser"
129− else return ()
130−
131-- | Parses one of a list of strings (tried in order).
121-- | Parses one of a list of strings (tried in order).
132oneOfStrings :: [String] -> GenParser Char st String
122oneOfStrings :: [String] -> GenParser Char st String
133oneOfStrings listOfStrings = choice $ map (try . string) listOfStrings
123oneOfStrings listOfStrings = choice $ map (try . string) listOfStrings