Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pushtag and poptag #24

Open
rhydlewis opened this issue Oct 8, 2024 · 1 comment
Open

pushtag and poptag #24

rhydlewis opened this issue Oct 8, 2024 · 1 comment

Comments

@rhydlewis
Copy link

When I run black against a beancount file containing pushtag and poptag, it throws an error rather than accept the entry and continue. I'm using these entries as per the Beancount Syntax "The Tag Stack"

Example file

option "operating_currency" "GBP"

2024-10-07 open Expenses:Misc GBP
2024-10-07 open Assets:Bank GBP

pushtag #test

2024-10-08 * "Payee" "Narration"
  Expenses:Misc                                     12.00 GBP
  Assets:Bank                                      -12.00 GBP

2024-10-09 * "Payee" "Narration"
  Expenses:Misc                                     10.00 GBP
  Assets:Bank                                      -10.00 GBP

poptag #test

cmd:bh format test.beancount

Result:

Traceback (most recent call last):
  File "/Users/xxx/.pyenv/versions/3.12.5/lib/python3.12/site-packages/lark/lexer.py", line 665, in lex
    yield lexer.next_token(lexer_state, parser_state)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/xxx/.pyenv/versions/3.12.5/lib/python3.12/site-packages/lark/lexer.py", line 598, in next_token
    raise UnexpectedCharacters(lex_state.text, line_ctr.char_pos, line_ctr.line, line_ctr.column,
lark.exceptions.UnexpectedCharacters: No terminal matches '#' in the current parser context, at line 6 col 9

pushtag #test
        ^
Expected one of:
	* COLON

Previous tokens: Token('METADATA_KEY', 'pushtag')
@fangpenlin
Copy link
Contributor

Thanks for reporting the issue. Currently, pushtag and poptag syntax are not implemented intentionally. Those syntax make beancount entries context dependent, therefore it's harder to sort the entries and regenerating the beancount file from the tree. I designed beancount-black to be opinioned regarding this. Unfortunately, we don't have the plan for supporting it in the short term.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants