From 41c985b5fbfcfb386999d2637981fe1de906a6ff Mon Sep 17 00:00:00 2001 From: Simon Michael Date: Thu, 26 Jul 2018 08:29:02 +0100 Subject: [PATCH] journal: ignore transaction comments in auto posting rules (#745) Previously they were misparsed as account names. --- hledger-lib/Hledger/Read/JournalReader.hs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/hledger-lib/Hledger/Read/JournalReader.hs b/hledger-lib/Hledger/Read/JournalReader.hs index d2eb7b6da..3e223a5f9 100644 --- a/hledger-lib/Hledger/Read/JournalReader.hs +++ b/hledger-lib/Hledger/Read/JournalReader.hs @@ -469,13 +469,15 @@ commodityconversiondirectivep = do --- ** transactions +-- TODO transactionmodifierp ? transactionrewritep ? modifiertransactionp :: JournalParser m ModifierTransaction modifiertransactionp = do char '=' "modifier transaction" lift (skipMany spacenonewline) - valueexpr <- T.pack <$> lift restofline + querytxt <- T.pack <$> lift restofline -- TODO should not consume a same-line comment + (_cmt, _tags) <- lift transactioncommentp -- TODO apply these to modified txns ? postings <- postingsp Nothing - return $ ModifierTransaction valueexpr postings + return $ ModifierTransaction querytxt postings -- | Parse a periodic transaction periodictransactionp :: MonadIO m => JournalParser m PeriodicTransaction @@ -648,7 +650,7 @@ postingsp mTransactionYear = many (postingp mTransactionYear) "postings" postingp :: Maybe Year -> JournalParser m Posting postingp mTransactionYear = do - -- dbgparse 0 "postingp" + -- lift $ dbgparse 0 "postingp" (status, account) <- try $ do lift (skipSome spacenonewline) status <- lift statusp