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
{{ message }}
Repository navigation
compat(parser): a pushtag, poptag or popmeta with an invalid date changes no state, and a pop error is on the pop's own line #2995
header_has_invalid_token only looks for ERROR_TOKEN. An invalid date on the header also fails beancount's reduction (the lexer raises it), so beancount neither pushes nor pops; main does both.
InvalidPoptag / InvalidPopmeta use node_span(node.syntax()), which starts at leading trivia (comment lines stored at the start of the node), so the error lands on the comment line.
(with the one-letter key k: the popmeta is itself an invalid token, and it matches: 1x2 3)
Suspected location: crates/rustledger-parser/src/cst/convert.rs, the Pushtag / Poptag / Popmeta arms (~311-370) and header_has_invalid_token (~3916). pushmeta with a date error already matches because pushmeta_value fails on it.
Fix direction: treat an invalid DATE token on the header line like an ERROR_TOKEN in header_has_invalid_token (or a sibling predicate), and give the pop errors the header-line span (first content token to the line's end) instead of the node span. This also removes the line-2 never popped error in #2993's pushtag #a 2024-02-30 row.
beancount side: beancount 3.2.3 in localhost/rustledger-compat, beancount.parser.parser.parse_string for parse rows (the parity harness's ground truth), beancount.loader.load_string for validation rows. Errors are raw: none are filtered.
rledger side: parse_error_lines example (rustledger_parser::parse + LineIndex, as in the parity harness) for parse rows, rledger check --format json for validation rows.
Counts are per-line: 3x2 is two errors on line 3, 2 4 is one on line 2 and one on line 4, 0 is beancount's "line 0" (end of file), - is no error.
Shorthand used in the inputs:
P = 2024-01-01 open Assets:A\n (the prefix the original table used)
S = 2024-02-30 5\n (the indented invalid-date line the original table used)
T = 2024-01-02 * "n"\n
O2 = 2024-01-01 open Assets:A\n2024-01-01 open Assets:B\n
<BOM> = U+FEFF
Split from #2872 (re-measured there; see the comment that lists where each row went).
Activity
fix(parser): a push or pop whose line has an error changes no state, …
fix(parser): push and pop take effect exactly where beancount builds …
fix(parser): push and pop take effect exactly where beancount builds …
fix(parser): push and pop take effect exactly where beancount builds …