jcornaz / beancount_parser_2

[DISCONTINUED]: See `beancount-parser` instead
The Unlicense
1 stars 1 forks source link

Support multiple values in options #32

Closed doriath closed 1 year ago

doriath commented 1 year ago

In my ledger I use following:

option "operating_currency" "USD"
option "operating_currency" "CHF"

I believe this is supported by fava, to show the sums in those two currencies. In the current parser, HashMap is used with one possible value, which I believe means will drop one of the values. Should options hashmap be changed to use Vec<&str> as a value?

jcornaz commented 1 year ago

Yes, you're right. Currently, it is a bug (or incorrect design). https://beancount.github.io/docs/beancount_language_syntax.html#operating-currencies clearly states (emphasis is mine):

For this reason, you are able to declare the most common currencies you use in an option: option "operating_currency" "USD" You may declare more than one.

We should store the options as Vec<(&str, &str)> (or equivalent) and adapt the api.