"John Wiegley" <jo...@newartisans.com> writes: >>>>>> Eric Abrahamsen <e...@ericabrahamsen.net> writes: > >> "John Wiegley" <jo...@newartisans.com> writes: >>>>>>>> Eric Abrahamsen <e...@ericabrahamsen.net> writes: >>> >>>> = expr recpt = tag("Receipt") and expr account =~ >>>> /^expenses:(transportation|food|books)/ (Assets:Receipts) ((recpt > 0) ? >>>> recpt : 1) >>> >>> Only use "expr" at the beginning. > >> Still getting the same error without the second "expr". Just reducing the >> matching line to this: > > Try this maybe? > > = expr has_tag("Receipt") and expr account =~ > /^expenses:(transportation|food|books)/ (Assets:Receipts) > ((tag("Receipt") > 0) ? tag("Receipt") : 1)
No, I'd tried that one before. It looks like parenthesis inside any "expr" clause will cause the parsing error. If there's no "expr", the parenthesis is read correctly and things seem to work. In your above suggestion, I got the parsing error at ("Receipt". If I take out the first "expr", I get the parsing error at (transportation|food|books)/, saying: Error: Missing '/'. The only way I can get it to work is to have no first "expr", use tag instead of has_tag (using has_tag simply produces no results), and have no parenthesis in the "expr account" clause. The ternary expression works if given as: ((to_amount(tag("Receipt")) > 0) ? to_amount(tag("Receipt")) : 1) So really all I'm missing there is the ability to match: = expr amount = to_amount(tag("Receipt")) and expr etc etc etc with parentheses in. Sorry to keep on with this -- it seems like a hassle just to get a little convenience. On the other hand, it really does seem to be just the one issue! Thanks, Eric -- --- You received this message because you are subscribed to the Google Groups "Ledger" group. To unsubscribe from this group and stop receiving emails from it, send an email to ledger-cli+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.