mirror of
https://github.com/simonmichael/hledger.git
synced 2024-11-08 07:09:28 +03:00
better parse error message when only one space before an amount
This commit is contained in:
parent
f0ec7b08a3
commit
fd506a6817
3
NOTES
3
NOTES
@ -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
|
||||
|
8
Parse.hs
8
Parse.hs
@ -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 =
|
||||
|
Loading…
Reference in New Issue
Block a user