hledger icon indicating copy to clipboard operation
hledger copied to clipboard

some auto posting rule parse issues

Open simonmichael opened this issue 7 years ago • 1 comments

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:from2018 work, as on the command line. You would also expect either = date:from\ 2018 or = date:from\\ 2018 to 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.

simonmichael avatar Jun 09 '18 10:06 simonmichael

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

simonmichael avatar Jun 09 '18 11:06 simonmichael

These are unimportant and/or no longer true and/or likely to be resolved eventually as part of deeper changes to rules. Closing.

simonmichael avatar Apr 27 '23 09:04 simonmichael