Sorry mate v2 is frozen. Not enough cycles to work on two versions.

On Sat, Sep 25, 2021 at 2:21 AM Jim Robinson <jim.robin...@gmail.com> wrote:

> Thank you for the confirmation.  I've never worked with flex, but I was
> wondering what it is that prevents adding a single-character token as an
> option?
>
> E.g., in lexer.l adding one additional [A-Z] token?
>
> 198 [A-Z] {
> 199     return TOKEN(CURRENCY, yytext, yyleng);
> 200 }
> 201 [A-Z][A-Z0-9\'\.\_\-]*[A-Z0-9] {
> 202     return TOKEN(CURRENCY, yytext, yyleng);
> 203 }
> 204 \/[A-Z0-9\'\.\_\-]*[A-Z]([A-Z0-9\'\.\_\-]*[A-Z0-9])? {
> 205     return TOKEN(CURRENCY, yytext, yyleng);
> 206 }
>
> In the spirit of blindly trying things I used the above change and it
> *seems* to parse OK.
>
> (venv) $ cat ~/tmp/odd.beancount
> 2014-02-16 open Assets:US:ETrade:Cash
> 2014-02-16 open Assets:US:ETrade:V
> 2014-02-16 open Expenses:Financial:Commissions
> 2014-02-16 open Equity:OpeningBalances
>
> 2014-02-16 * "Opening Balance"
>      Assets:US:ETrade:Cash    10,000.00 USD
>        Equity:OpeningBalances
>
> 2014-02-16 * "Buying some V"
>      Assets:US:ETrade:V               10.00 V {231.59 USD}
>      Assets:US:ETrade:Cash
>
> (venv) $ bean-query ~/tmp/odd.beancount
> Input file: "Beancount"
> Ready with 6 directives (4 postings in 2 transactions).
> beancount> balances
>         account                           sum_position
> ----------------------          --------------------------
> Assets:US:ETrade:Cash         7684.10 USD
> Assets:US:ETrade:V                  10.00 V {231.59 USD}
> Equity:OpeningBalances     -10000.00 USD
>
> On Friday, September 24, 2021 at 10:06:52 PM UTC-7 bl...@furius.ca wrote:
>
>> I was going to send a link to that section; you found it.
>> The C++ parser is in branch "master" but it's not hooked up yet, it won't
>> be running.
>> I'm still working on finishing it (actually, these days).
>>
>> My plan is to finish it, then to translate the booking code to C++  (with
>> improvements in the design doc), and make a one-time conversion to Python
>> objects, so we can use all the existing code and hook up the new parser.
>>
>> Just use V_ in the meantime.
>> (Or trade options instead of single stocks... "V_211015_P222.5" is a
>> valid currency symbol... you can sell ATM puts and size up a bit for
>> equivalent delta exposure with a theta component.  Okay okay, never mind...)
>>
>>
>>
>>
>>
>> On Sat, Sep 25, 2021 at 12:35 AM Jim Robinson <jim.ro...@gmail.com>
>> wrote:
>>
>>> Huh, digging around in the source code I see it very specifically talks
>>> about "V" as being a valid currency symbol in v3:
>>>
>>>
>>> https://github.com/beancount/beancount/blob/master/beancount/parser/lexer.l#L161-L204
>>>
>>> It looks like my install is 2.3.4 (it was recommended on the homepage
>>> that we not use the master branch)
>>>
>>> On Friday, September 24, 2021 at 9:18:26 PM UTC-7 Jim Robinson wrote:
>>>
>>>> Oh, and please forgive the unbalanced transaction issue, I was just
>>>> messing around with the example documentation and hadn't corrected that
>>>> problem when I ran into the 'Invalid token' issue I was complaining about.
>>>>
>>>> On Friday, September 24, 2021 at 9:13:23 PM UTC-7 Jim Robinson wrote:
>>>>
>>>>> At first glance I can't see that there is a way to override what
>>>>> beancount is doing here.
>>>>>
>>>>> It appears as though it has some sort of an opinionated parsers as to
>>>>> what is considered valid for a Ticker Symbol, and it won't accept "V" (the
>>>>> symbol for Visa).  It appears to be wanting an all-uppercase > 1 length
>>>>> symbol, which isn't really valid for the real world.
>>>>>
>>>>> Is there a way to override this behavior?  I'm not spotting anything
>>>>> on my first pass of the options documentation.
>>>>>
>>>>> The following ledger fails to parse, complaining about an invalid
>>>>> token 'V' (specifically it is complaining about the use of the ticker
>>>>> symbol as a unit in "10.00 V", it's fine with the account name).
>>>>>
>>>>> 2014-02-16 open Assets:US:ETrade:Cash
>>>>> 2014-02-16 open Assets:US:ETrade:V
>>>>> 2014-02-16 open Expenses:Financial:Commissions
>>>>> 2014-02-16 open Equity:OpeningBalances
>>>>>
>>>>> 2014-02-16 * "Opening Balance"
>>>>>   Assets:US:ETrade:Cash         10,000.00 USD
>>>>>   Equity:OpeningBalances
>>>>>
>>>>> 2014-02-16 * Example purchase of stock symbol V (Visa)
>>>>>   Assets:US:ETrade:V                      10.00 V {231.59 USD}
>>>>>   Assets:US:ETrade:Cash        -23,159.00 USD
>>>>>   Expenses:Financial:Commissions    9.95 USD
>>>>>
>>>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Beancount" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to beancount+...@googlegroups.com.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/beancount/2436d5fd-314c-45c5-8853-8880588661afn%40googlegroups.com
>>> <https://groups.google.com/d/msgid/beancount/2436d5fd-314c-45c5-8853-8880588661afn%40googlegroups.com?utm_medium=email&utm_source=footer>
>>> .
>>>
>> --
> You received this message because you are subscribed to the Google Groups
> "Beancount" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to beancount+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/beancount/5c94994f-6f92-4c56-bdb1-3c47003882dfn%40googlegroups.com
> <https://groups.google.com/d/msgid/beancount/5c94994f-6f92-4c56-bdb1-3c47003882dfn%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Beancount" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to beancount+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/CAK21%2BhPVfS0ULJQFUkD50ixUi3wy5GG%2Betp8rs7N%3DBrGBYR94w%40mail.gmail.com.

Reply via email to