ledger-mode
ledger-mode copied to clipboard
ledger-display-balance-at-point does not parse account name properly
When the currency unit is placed after the value, the account name is not parsed properly. Example :
Assets:AnyAccount 1000 EUR
C-c C-p
gives
Assets:AnyAccount 1000 EUR is empty
Yes. This is a bug related to an error in the parser that doesn't pull out the account properly when the amount is followed by the commodity. I have been working on it for a while but overtime I think I have it fixed, the fix breaks something else.
On Thu, Apr 20, 2017 at 11:09 PM, vizietto [email protected] wrote:
When the currency unit is placed after the value, the account name is not parsed properly. Example :
Assets:AnyAccount 1000 EUR
C-c C-p gives
Assets:AnyAccount 1000 EUR is empty
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/ledger/ledger-mode/issues/31, or mute the thread https://github.com/notifications/unsubscribe-auth/AA1rLDj91cSkjuZvt-4crtHHcQVBjW4qks5ryEgsgaJpZM4ND5qh .
-- Craig, Corona De Tucson, AZ [image: missile_flyout] enderw88.wordpress.com
To my eye, in current master
(9dca0962), it looks like the commodity regexp is missing a +
. As is, it matches a quoted string or a single allowed character, whereas a commodity can be multiple allowed characters.
(ledger-define-regexp commodity
(rx (group
(or (and ?\" (+ (not (any ?\"))) ?\")
+ (+
(not (any blank ?\n
digit
?- ?\[ ?\]
?. ?, ?\; ?+ ?* ?/ ?^ ?? ?: ?& ?| ?! ?=
?\< ?\> ?\{ ?\} ?\( ?\) ?@)))))
+ )
"")
What breaks if this change is introduced?