From 79880de744713312c1232c5f31c57b175ed5fb32 Mon Sep 17 00:00:00 2001 From: Simon Michael Date: Sat, 20 Jun 2009 04:01:25 +0000 Subject: [PATCH] don't let ledgercomment parser always pass --- Ledger/Parse.hs | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/Ledger/Parse.hs b/Ledger/Parse.hs index 6c0c161f9..0788df99e 100644 --- a/Ledger/Parse.hs +++ b/Ledger/Parse.hs @@ -251,13 +251,11 @@ emptyLine = do many spacenonewline return () ledgercomment :: GenParser Char st String -ledgercomment = - try (do - char ';' - many spacenonewline - many (noneOf "\n") - ) - <|> return "" "comment" +ledgercomment = do + many1 $ char ';' + many spacenonewline + many (noneOf "\n") + "comment" ledgercommentline :: GenParser Char st String ledgercommentline = do @@ -316,7 +314,7 @@ ledgerTransaction = do status <- ledgerstatus code <- ledgercode description <- many1 spacenonewline >> liftM rstrip (many1 (noneOf ";\n") "description") - comment <- ledgercomment + comment <- ledgercomment <|> return "" restofline postings <- ledgerpostings let t = LedgerTransaction date edate status code description comment postings "" @@ -392,7 +390,7 @@ ledgerposting = do let (ptype, account') = (postingTypeFromAccountName account, unbracket account) amount <- postingamount many spacenonewline - comment <- ledgercomment + comment <- ledgercomment <|> return "" restofline return (Posting status account' amount comment ptype)