allow extra whitespace and comments at end of ledger

This commit is contained in:
Simon Michael 2008-11-22 07:00:52 +00:00
parent 1607661b87
commit a49b9715ef
3 changed files with 6 additions and 5 deletions

View File

@ -171,14 +171,14 @@ ledger = do
modifier_entries <- many ledgermodifierentry modifier_entries <- many ledgermodifierentry
periodic_entries <- many ledgerperiodicentry periodic_entries <- many ledgerperiodicentry
entries <- (many ledgerentry) <?> "entry" entries <- (many $ try ledgerentry) <?> "entry"
final_comment_lines <- ledgernondatalines final_comment_lines <- ledgernondatalines
eof eof
return $ RawLedger modifier_entries periodic_entries entries (unlines final_comment_lines) return $ RawLedger modifier_entries periodic_entries entries (unlines final_comment_lines)
ledgernondatalines :: Parser [String] ledgernondatalines :: Parser [String]
ledgernondatalines = many (ledgerdirective <|> -- treat as comments ledgernondatalines = many (try ledgerdirective <|> -- treat as comments
commentline <|> try commentline <|>
blankline) blankline)
ledgerdirective :: Parser String ledgerdirective :: Parser String

2
NOTES
View File

@ -6,8 +6,6 @@ implementations were its consequences." --Niklaus Wirth
* to do * to do
** errors ** errors
*** ? in description or amount gives "too many blank transactions"
*** parse commented lines at end of file
*** display mixed amounts vertically, not horizontally *** display mixed amounts vertically, not horizontally
** features ** features
*** flexible date expressions, for easier time reports *** flexible date expressions, for easier time reports

View File

@ -34,3 +34,6 @@
2008/1/1 * pay off 2008/1/1 * pay off
liabilities:debts $1 liabilities:debts $1
assets:checking assets:checking
;final comment