transactionamount -> postingamount

This commit is contained in:
Simon Michael 2009-04-07 21:18:51 +00:00
parent d8fe2aabb2
commit 32a3af8334
2 changed files with 9 additions and 9 deletions

View File

@ -368,7 +368,7 @@ normalposting :: GenParser Char LedgerFileCtx Posting
normalposting = do normalposting = do
status <- ledgerstatus status <- ledgerstatus
account <- transactionaccountname account <- transactionaccountname
amount <- transactionamount amount <- postingamount
many spacenonewline many spacenonewline
comment <- ledgercomment comment <- ledgercomment
restofline restofline
@ -381,7 +381,7 @@ virtualposting = do
char '(' char '('
account <- transactionaccountname account <- transactionaccountname
char ')' char ')'
amount <- transactionamount amount <- postingamount
many spacenonewline many spacenonewline
comment <- ledgercomment comment <- ledgercomment
restofline restofline
@ -394,7 +394,7 @@ balancedvirtualposting = do
char '[' char '['
account <- transactionaccountname account <- transactionaccountname
char ']' char ']'
amount <- transactionamount amount <- postingamount
many spacenonewline many spacenonewline
comment <- ledgercomment comment <- ledgercomment
restofline restofline
@ -417,8 +417,8 @@ ledgeraccountname = do
accountnamechar = notFollowedBy (oneOf "()[]") >> nonspace accountnamechar = notFollowedBy (oneOf "()[]") >> nonspace
<?> "account name character (non-bracket, non-parenthesis, non-whitespace)" <?> "account name character (non-bracket, non-parenthesis, non-whitespace)"
transactionamount :: GenParser Char st MixedAmount postingamount :: GenParser Char st MixedAmount
transactionamount = postingamount =
try (do try (do
many1 spacenonewline many1 spacenonewline
a <- someamount <|> return missingamt a <- someamount <|> return missingamt

View File

@ -734,9 +734,9 @@ tests = [
nulltxn{date=parsedate "2008/01/01",description="- 2008/12/31",account="",amount=Mixed [dollars 15]} nulltxn{date=parsedate "2008/01/01",description="- 2008/12/31",account="",amount=Mixed [dollars 15]}
] ]
,"transactionamount" ~: do ,"postingamount" ~: do
parseWithCtx transactionamount " $47.18" `parseis` Mixed [dollars 47.18] parseWithCtx postingamount " $47.18" `parseis` Mixed [dollars 47.18]
parseWithCtx transactionamount " $1." `parseis` parseWithCtx postingamount " $1." `parseis`
Mixed [Amount (Commodity {symbol="$",side=L,spaced=False,comma=False,precision=0}) 1 Nothing] Mixed [Amount (Commodity {symbol="$",side=L,spaced=False,comma=False,precision=0}) 1 Nothing]
] ]
@ -1147,5 +1147,5 @@ rawLedgerWithAmounts as =
[] []
[] []
"" ""
where parse = fromparse . parseWithCtx transactionamount . (" "++) where parse = fromparse . parseWithCtx postingamount . (" "++)