Created a separate parser list for all parsers (except the unit parser

is replaced with the non-newline unit parser); use that parser when
parsing list lines
usingMegaparsec
Aadhavan Srinivasan 3 weeks ago
parent 04167e0f96
commit 6b99a1835d

@ -298,17 +298,16 @@ lineParsers =
parseUnit parseUnit
] -- A 'line' doesn't include a 'header' ] -- A 'line' doesn't include a 'header'
listLineParsers :: [Parser MdToken] lineParsersWithoutNewline :: [Parser MdToken]
listLineParsers = lineParsersWithoutNewline =
[ parseLinebreak, [ parseEscapedChar,
parseEscapedChar,
parseCode, parseCode,
parseImage, parseImage,
parseBold, parseBold,
parseItalic, parseItalic,
parseStrikethrough, parseStrikethrough,
parseLink, parseLink,
parseUnit parseUnitExceptNewline
] -- A list line cannot contain newlines. ] -- A list line cannot contain newlines.
-- List of all parsers -- List of all parsers
@ -321,7 +320,7 @@ parseLineToken = fallthroughParser lineParsers
-- Parse any of the list line tokens. -- Parse any of the list line tokens.
parseListLineToken :: Parser MdToken parseListLineToken :: Parser MdToken
parseListLineToken = fallthroughParser listLineParsers parseListLineToken = fallthroughParser lineParsersWithoutNewline
-- Parse a line, consisting of one or more tokens. -- Parse a line, consisting of one or more tokens.
parseLine :: Parser MdToken parseLine :: Parser MdToken

Loading…
Cancel
Save