On Thu, Aug 9, 2018 at 1:51 PM <[email protected]> wrote:

> Hi,
>
> I wanted to flag transactions (and postings) with a flag that is not one
> of the standard *, !, txn. The documentation in "Beancount - Language
> Syntax" suggested that I should be able to use any character for
> transactions & postings (and perhaps even a string for the transaction).
>
> However, for the example below, bean-check complains with "Invalid token:
> 'D'".
> 2017-01-01 open Income:Salary USD
> 2017-01-01 open Assets:Bank USD
>
> 2017-01-02 D "Paycheck"
>   Income:Salary -10 USD
>   Assets:Bank  10 USD
>
> It is, however, happy with the characters M or T.
>
> I was trying to reason why that is the case. Looking at the parsing
> grammar in grammar.y
> <https://bitbucket.org/blais/beancount/src/2b20d301782528147e0aba744da9a014323ef630/beancount/parser/grammar.y?at=2.1.2&fileviewer=file-view-default#grammar.y-262>,
> I thought any character should be ok. TXN, ASTERISK and HASH are handled
> specially, but the FLAG option might reference any character :
>
> %token <character> FLAG    /* Valid characters for flags */
>
>
> But then there is code in lexer.l
> <https://bitbucket.org/blais/beancount/src/2b20d301782528147e0aba744da9a014323ef630/beancount/parser/lexer.l?at=2.1.2&fileviewer=file-view-default#lexer.l-211>
>  that
> restricts the characters to [!&#?%PSTCURM]; and some python macros for them
> in flags.py
> <https://bitbucket.org/blais/beancount/src/2b20d301782528147e0aba744da9a014323ef630/beancount/core/flags.py?at=2.1.2&fileviewer=file-view-default>
> .
>
> Is there some underlying reason for this restriction?
>

Limitations on the lexer.
At some point I intend to rewrite it as a custom lexer instead of using
flex.
Hasn't been a huge priority.
Agreed it should be documented better (feel free to suggest in the doc,
I'll accept).



> How can I go about flagging transactions in a custom way? Using metadata
> seems like one way (although, I did hope that there was a way to use custom
> flags)
>

Yes, that, or tags.




>
> Thanks,
> Shree
>
> PS: I should also mention that I'm not very familiar with YACC - so I
> might also be missing something.
>

No you're right, it's defined that way.





> --
> 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 [email protected].
> To post to this group, send email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/beancount/14ac7f0c-b4eb-481d-8152-9db28ad04f79%40googlegroups.com
> <https://groups.google.com/d/msgid/beancount/14ac7f0c-b4eb-481d-8152-9db28ad04f79%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/CAK21%2BhNViXAFR4XH9xjNQBFEGjsO5zDH1aDUFw_6vcrAO7OXcA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to