X.P.OrgMode: Parse empty message

Empty messages seem quite useless, but it's an easy fix for the parser
to be able to deal with them, so do it.
This commit is contained in:
slotThe 2021-06-12 14:07:14 +02:00
parent c1cb3aaa24
commit 4b15ea2ecc

View File

@ -339,8 +339,9 @@ pInput inp = fmap fst . listToMaybe . (`readP_to_S` inp) . lchoice $
getLast :: String -> ReadP String
getLast ptn = go ""
where
go :: String -> ReadP String = \consumed -> do
next <- munch1 (/= head ptn)
go :: String -> ReadP String
go consumed = do
next <- munch (/= head ptn)
next' <- munch1 (/= ' ')
if next' == ptn
then -- If we're done, it's time to prune extra whitespace