mirror of
https://github.com/simonmichael/hledger.git
synced 2024-11-07 21:15:19 +03:00
eat space before value & period expressions
This commit is contained in:
parent
eddcb6b92a
commit
27a6255404
10
hledger.hs
10
hledger.hs
@ -297,6 +297,7 @@ ledgertransactions = (ledgertransaction <?> "transaction") `manyTill` (newline <
|
||||
-- "automated entry"
|
||||
ledgermodifierentry = do
|
||||
char '=' <?> "entry"
|
||||
many spacenonewline
|
||||
valueexpr <- restofline
|
||||
transactions <- ledgertransactions
|
||||
ledgernondatalines
|
||||
@ -304,6 +305,7 @@ ledgermodifierentry = do
|
||||
|
||||
ledgerperiodicentry = do
|
||||
char '~' <?> "entry"
|
||||
many spacenonewline
|
||||
periodexpr <- restofline
|
||||
transactions <- ledgertransactions
|
||||
ledgernondatalines
|
||||
@ -350,7 +352,7 @@ spacenonewline = satisfy (\c -> c `elem` " \v\f\t")
|
||||
|
||||
-- run tests
|
||||
|
||||
main = do
|
||||
test = do
|
||||
parseTest ledgertransaction sample_transaction
|
||||
parseTest ledgertransaction sample_transaction2
|
||||
parseTest ledgerentry sample_entry
|
||||
@ -369,6 +371,9 @@ main = do
|
||||
parseTest ledger sample_periodic_entry2
|
||||
parseMyLedgerFile >>= showParseResult
|
||||
return ()
|
||||
-- assert_ $ amount t1 == 8.50
|
||||
-- putStrLn "ok"
|
||||
-- where assert_ e = assert e return ()
|
||||
|
||||
parseMyLedgerFile = do
|
||||
fname <- ledgerFilePath
|
||||
@ -389,6 +394,3 @@ showParseResult r =
|
||||
print x
|
||||
putStr $ show $ length $ entries x; putStr " entries\n"
|
||||
|
||||
-- assert_ $ amount t1 == 8.50
|
||||
-- putStrLn "ok"
|
||||
-- where assert_ e = assert e return ()
|
||||
|
Loading…
Reference in New Issue
Block a user