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
|
* TO DO
|
||||||
** bugs
|
** bugs
|
||||||
*** unclear parse error when only one space before amount
|
|
||||||
unexpected "$"
|
|
||||||
expecting letter or digit, ":", "/", "_", amount, comment or new-line
|
|
||||||
*** handle unknown currencies
|
*** handle unknown currencies
|
||||||
** compatibility
|
** compatibility
|
||||||
** basic features
|
** basic features
|
||||||
|
|||||||
8
Parse.hs
8
Parse.hs
@ -210,8 +210,8 @@ ledgertransactions = (ledgertransaction <?> "transaction") `manyTill` (do {newli
|
|||||||
ledgertransaction :: Parser Transaction
|
ledgertransaction :: Parser Transaction
|
||||||
ledgertransaction = do
|
ledgertransaction = do
|
||||||
many1 spacenonewline
|
many1 spacenonewline
|
||||||
account <- ledgeraccount <?> "account"
|
account <- ledgeraccount
|
||||||
amount <- ledgeramount <?> "amount"
|
amount <- ledgeramount
|
||||||
many spacenonewline
|
many spacenonewline
|
||||||
ledgereol
|
ledgereol
|
||||||
many ledgercomment
|
many ledgercomment
|
||||||
@ -219,7 +219,9 @@ ledgertransaction = do
|
|||||||
|
|
||||||
-- account names may have single spaces in them, and are terminated by two or more spaces
|
-- account names may have single spaces in them, and are terminated by two or more spaces
|
||||||
ledgeraccount :: Parser String
|
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 :: Parser Amount
|
||||||
ledgeramount =
|
ledgeramount =
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user