parsing: fix timelog parsing

This commit is contained in:
Simon Michael 2009-12-07 23:29:19 +00:00
parent 10923f6fb1
commit 5493a604e3
2 changed files with 13 additions and 3 deletions

View File

@ -345,6 +345,7 @@ ledgerpartialdate = do
ledgerdatetime :: GenParser Char LedgerFileCtx LocalTime
ledgerdatetime = do
day <- ledgerdate
many1 spacenonewline
h <- many1 digit
char ':'
m <- many1 digit
@ -553,9 +554,8 @@ timelogentry = do
code <- oneOf "bhioO"
many1 spacenonewline
datetime <- ledgerdatetime
many1 spacenonewline
comment <- liftM2 (++) getParentAccount restofline
return $ TimeLogEntry (read [code]) datetime comment
comment <- optionMaybe (many1 spacenonewline >> liftM2 (++) getParentAccount restofline)
return $ TimeLogEntry (read [code]) datetime (fromMaybe "" comment)
-- misc parsing

10
tests/timelog.test Normal file
View File

@ -0,0 +1,10 @@
-f - print
<<<
i 2009/1/1 08:00:00 x
o 2009/1/1 09:00:00
>>>
2009/01/01 * 08:00-09:00
x 1.0h
>>>2