You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I recently upgraded an installation from beancount 2.0rc1 on 2.3.5 and several of my files started getting syntax error, unexpected ASTERISK from bean-check test.bean. (With python 3.9 on debian.)
Line 2 gets the error, it is just an asterisk on a line by itself.
Line 6 does NOT get the error, it is an asterisk followed by a space.
test.bean:
* this is a comment
*
* The line above is part of a commented-series of lines, it does not have a
* trailing space. The line below has a trailing space.
*
2022-01-01 open Assets:Cash USD
2022-01-01 open Expenses:Misc USD
2022-01-02 * "blah"
Assets:Cash -1.00 USD
Expenses:Misc 1.00 USD
The workaround appears to be to replace a lone asterisk on a line with asterisk+space (:%s/^\*$/* /) -- or delete these lines.
I created a python 3.9 venv to test, and it appears that this change occurred between 2.3.2 and 2.3.3.
The text was updated successfully, but these errors were encountered:
This works as intended. Comments in Beancount are introduced by a semicolon ; or an hash # character. The asterisk * is allowed only for org-mode-style sectioning headers.
According to the documentation, # is not a comment character -- ; is the only comment character, except for other characters that work as comment characters:
Any line that does not begin as a valid Beancount syntax directive (e.g. with a date) is silently ignored.
While experimenting with various things that may or may not be treated as comments across the 2.0/2.3.3 version boundary, I found that this file would parse as valid in 2.0 but not in 2.3.3:
; this is an indented comment, which is valid in 2.0 but a syntax error in 2.3.3
2022-01-01 open Assets:Cash USD
2022-01-01 open Expenses:Misc USD
2022-01-02 * "blah"
Assets:Cash -1.00 USD
Expenses:Misc 1.00 USD
This yields the error message: test.bean:1: syntax error, unexpected INDENT. This contradicts the documentation:
Any text on a line after the character “;” is ignored
Note that replacing the semicolon with a hash on line 1 of that file becomes a syntax error (unexpected HASH) in both 2.0 and 2.3.3.
I don't really expect these issues to get fixed, but I thought it might save someone a few minutes if they search for this error message.
Though I suppose you could consider this as a documentation error about what is considered valid syntax.
I recently upgraded an installation from beancount 2.0rc1 on 2.3.5 and several of my files started getting
syntax error, unexpected ASTERISK
frombean-check test.bean
. (With python 3.9 on debian.)Line 2 gets the error, it is just an asterisk on a line by itself.
Line 6 does NOT get the error, it is an asterisk followed by a space.
test.bean:
The workaround appears to be to replace a lone asterisk on a line with asterisk+space (
:%s/^\*$/* /
) -- or delete these lines.I created a python 3.9 venv to test, and it appears that this change occurred between 2.3.2 and 2.3.3.
The text was updated successfully, but these errors were encountered: