hledger
hledger copied to clipboard
some auto posting rule parse issues
2018/1/1
(a) 1
= date:from 2018
b 1
$ hledger-1.9 -f a.j print --auto
2018/01/01
hledger-1.9: "date:from" gave a date parse error ()
The date: query term fails to parse because of the space. This is probably ok as it wouldn't parse on the command line either. Issues:
-
would the parse error be clearer if it (also) said:
"date:from 2018" could not be parsed as a query expression? -
= date:'from 2018',= date:"from 2018",= date:from2018work, as on the command line. You would also expect either= date:from\ 2018or= date:from\\ 2018to work, but they don't. -
any junk after a valid period expression is ignored (
= date:'from 2018' blah blah). We should give an error or require it to be commented or something. -
transactions are checked for balanced postings before automated postings are added, and not afterward; it should probably be the reverse.
-
auto posting rules are parsed lazily, and should probably be parsed eagerly along with the rest of the journal, like periodic rules are about to be.
Related: https://github.com/simonmichael/hledger/blob/master/hledger-lib/Hledger/Read/JournalReader.hs#L451 https://github.com/simonmichael/hledger/blob/master/hledger-lib/Hledger/Data/AutoTransaction.hs#L71
These are unimportant and/or no longer true and/or likely to be resolved eventually as part of deeper changes to rules. Closing.