parsing: support pop as well as end tag

This commit is contained in:
Johann Klähn 2011-05-31 17:41:12 +00:00
parent 75f0886ad4
commit 8e7d20e4d5

View File

@ -300,7 +300,7 @@ ledgerTagDirective = do
ledgerEndTagDirective :: GenParser Char JournalContext JournalUpdate ledgerEndTagDirective :: GenParser Char JournalContext JournalUpdate
ledgerEndTagDirective = do ledgerEndTagDirective = do
string "end tag" <?> "end tag directive" (string "end tag" <|> string "pop") <?> "end tag or pop directive"
restofline restofline
return $ return id return $ return id
@ -708,6 +708,8 @@ tests_Hledger_Read_JournalReader = TestList [
,"ledgerEndTagDirective" ~: do ,"ledgerEndTagDirective" ~: do
assertParse (parseWithCtx nullctx ledgerEndTagDirective "end tag \n") assertParse (parseWithCtx nullctx ledgerEndTagDirective "end tag \n")
,"ledgerEndTagDirective" ~: do
assertParse (parseWithCtx nullctx ledgerEndTagDirective "pop \n")
,"ledgeraccountname" ~: do ,"ledgeraccountname" ~: do
assertBool "ledgeraccountname parses a normal accountname" (isRight $ parsewith ledgeraccountname "a:b:c") assertBool "ledgeraccountname parses a normal accountname" (isRight $ parsewith ledgeraccountname "a:b:c")