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 :: String -> ReadP String
getLast ptn = go "" getLast ptn = go ""
where where
go :: String -> ReadP String = \consumed -> do go :: String -> ReadP String
next <- munch1 (/= head ptn) go consumed = do
next <- munch (/= head ptn)
next' <- munch1 (/= ' ') next' <- munch1 (/= ' ')
if next' == ptn if next' == ptn
then -- If we're done, it's time to prune extra whitespace then -- If we're done, it's time to prune extra whitespace