better parse error message when only one space before an amount

This commit is contained in:
Simon Michael 2007-07-04 01:49:16 +00:00
parent f0ec7b08a3
commit fd506a6817
2 changed files with 5 additions and 6 deletions

3
NOTES
View File

@ -2,9 +2,6 @@ hledger project notes
* TO DO
** bugs
*** unclear parse error when only one space before amount
unexpected "$"
expecting letter or digit, ":", "/", "_", amount, comment or new-line
*** handle unknown currencies
** compatibility
** basic features

View File

@ -210,8 +210,8 @@ ledgertransactions = (ledgertransaction <?> "transaction") `manyTill` (do {newli
ledgertransaction :: Parser Transaction
ledgertransaction = do
many1 spacenonewline
account <- ledgeraccount <?> "account"
amount <- ledgeramount <?> "amount"
account <- ledgeraccount
amount <- ledgeramount
many spacenonewline
ledgereol
many ledgercomment
@ -219,7 +219,9 @@ ledgertransaction = do
-- account names may have single spaces in them, and are terminated by two or more spaces
ledgeraccount :: Parser String
ledgeraccount = many1 (alphaNum <|> char ':' <|> char '/' <|> char '_' <|> try (do {spacenonewline; do {notFollowedBy spacenonewline; return ' '}}))
ledgeraccount =
many1 ((alphaNum <|> char ':' <|> char '/' <|> char '_' <?> "account name")
<|> try (do {spacenonewline; do {notFollowedBy spacenonewline; return ' '}} <?> "double space"))
ledgeramount :: Parser Amount
ledgeramount =