Skip to content

fix(parser): read a date as beancount does, and name every invalid date on its line - #2868

Merged
robcohen merged 12 commits into
mainfrom
fix/dates-extra-digits-as-beancount
Nov 5, 2026
Merged

robcohen merged 12 commits into
mainfrom
fix/dates-extra-digits-as-beancount

Conversation

@robcohen

@robcohen robcohen commented Nov 5, 2026 •

Copy link
Copy Markdown
Member

What changed

Dates read as beancount reads them (#2808). beancount's DATE is [0-9]{4,}[-/][0-9]+[-/][0-9]+, with the three fields read as integers, so 02024-01-01, 2024-001-01 and 2024-01-016 are dates there. Our lexer took \d{4}[-/]\d{1,2}[-/]\d{1,2}, so:

Now the lexer takes beancount's rule exactly, ASCII digits included ([0-9], not Unicode \d, so 2024-0١-01 is no date, as in beancount). One rule, parse_date_token (through diagnostics::date_fields), decides whether the fields form a real date: years 1 to 9999, as Python's datetime.date allows. The stopgap is gone: split_beancount_date, the pushmeta split-date exemption, and the 440 pinned date rows in the stray-character matrix. Those rows now match beancount and are checked like any other. An out-of-range field is named as written, however long (year 99999999999999999999999 out of range, not a saturated u64).

Every invalid date named, standing for the grammar errors it causes (#2856). beancount builds a date while lexing, so a bad date is a lexer error. It is named in every position, two on one line are two errors, and the parser never sees a date token there, so nothing at or after the date gets a grammar error on top. A grammar error before the date still stands, because the parser fails there first: balance Assets:A USD 2024-02-30 is unexpected CURRENCY plus the date in bean-check, and here too. report_invalid_dates, one pass over the green tree after all other checks, applies that rule in one place. It replaces the three per-line value-date checks.

  • Positions that now name the date: an event value, a price, a transaction header, option and plugin arguments, and an orphan indented line. Before, these gave a generic syntax error.
  • More than one bad date: two bad dates in one custom are two errors.
  • Under a bad header date: a bad value date under a directive whose own date is bad is reported too.
  • Lexer errors on the line still stand: beancount's lexer goes on past the date, so a stray character or a mid-file BOM on the same line is still reported (an error covering an ERROR_TOKEN is kept). Only grammar errors are dropped.
  • A date inside an invalid token is not named: beancount takes an invalid character and the rest of its non-blank run as one token, so `2024-02-30 is one Invalid token there and the date is never read. The same date after a blank is named.

The pass is linear: dates are sorted, line bounds come from one forward pass, and errors are matched by binary search. A counter-based test pins it (test_report_invalid_dates_is_linear_in_the_input).

Columns in constant time. rledger check --format json found each diagnostic's column by walking its line, twice per diagnostic, so thousands of errors on one long line were quadratic. That predates this PR (40,000 stray characters on one line take 2.2 s on main), but this PR made it reachable through dates. SourceFile::line_col and LineIndex now count characters through a table of marks every 256 bytes. The drift guard against line_col_in gains lines longer than the stride, with multi-byte characters across the marks.

FFI input. Dates built from embedder input (rustledger-ffi-wasi input.rs) go through the same rule, via the new public rustledger_parser::parse_date, which takes only text the lexer reads as one DATE token. So year 0 is refused there, and so are 24-01-15 and 1-1-1, which the old jiff path refused and which must not load as the years 24 and 1. An invalid cost date is an error instead of silently leaving the lot undated.

Completion. rustledger-completion recognized only YYYY-MM-DD at line start, so completion after a 2024-1-1 or 02024-01-01 header was missing. It now asks the lexer, through the new rustledger_parser::leading_date_len (implemented as is_valid_account_name is, by running the lexer).

normalize_date_str is removed. It was a second date rule, and nothing called it any more. The lexer's #![expect(clippy::large_stack_frames)] is removed too: with ASCII [0-9] the generated lexer frame no longer trips the lint, so the expectation went unfulfilled.

Compared with bean-check 3.2.3

Probe files:

Every file gets parse errors on the lines bean-check reports, with two exceptions that predate this PR: an indented line under a directive with a bad date still gets its own P0012, where beancount's error recovery swallows it, and a date after an unterminated " is not named. On the #2856 shapes and the lexer-error shapes the counts match too. Elsewhere a count can differ where rledger's error recovery splits or merges an error that beancount reports once, with or without this PR (`x2024-02-30 is one invalid token in beancount and two errors here). Examples:

Input bean-check before now
02024-01-01 open Assets:A ok P0012 ok
kk: 2024-002-02 the date 2024-02-02 P0012 (stopgap; on main before #2810, the number 2020) the date 2024-02-02
kk: 20024-02-02 year 20024 is out of range P0012 P0015 year 20024 out of range
2024-01-02 event "e" 2024-02-30 day is out of range P0012 P0015
2024-02-30 custom "x" 2024-02-31 2 errors 1 2
custom "x" 2024-02-30 2024-13-01 2 errors 1 2
custom "x" 2024-02-30 ` the date + Invalid token 1 2
custom "x" `2024-02-30 Invalid token only 1 1, no date error

Fuzz corpus against beancount's parser. I took the 18,176 UTF-8 inputs in fuzz_parse and fuzz_green_eq_red that contain a date-shaped run, parsed each with beancount's parse_string and with rustledger_parser::parse, and counted parse errors per file (beancount crashed on 16, which are left out). Exact agreement is rare on fuzz input either way, because the two recover from errors differently:

files with beancount's count
main 1,156
this PR 1,200
matched on main, not here 43
matched here, not on main 87

The first push dropped every non-date error on a bad-date line; on the same files it lost 89 matches. Of the 43 still lost, most are run-on fuzz dates (999999-9999998/993-...), where main split the date and reported a metadata-line error that happened to match beancount's count, and beancount names a year that rledger's recovery reads differently. Others are rledger grammar checks that stand in for a beancount lexer error (a one-letter flag must be followed by a space, top-level directive must start at column 0) on a line that also has a bad date. They are dropped with the other grammar errors the date reaches. Real ledgers show none of this (below).

Differences in what follows a parse error predate this PR. rledger keeps a directive that has a stray token, as decided in #2802, so booking can add its own error, while beancount drops the directive.

Performance on hostile input

rledger check --format json, release builds, best of 3, run back to back (the load average was around 30, so compare ratios):

Input main first push now
one custom line + 40,000 × 2024-02-30 41 ms (1 error) 59.7 s 83 ms (40,000 errors)
the same with 5,000 dates 12 ms (1 error) 1.05 s 13 ms (5,000 errors)
40,000 bad-date lines alternating with 40,000 stray-character lines 316 ms 1.44 s 293 ms
one line of 40,000 stray ` 2,218 ms 2.9 s 73 ms

Review round 2

  • Grammar errors before the date stand. Round 1 dropped every grammar error starting on a bad-date line, so an error before the date was lost: 2024-01-02 balance Assets:A USD 2024-02-30 and 2024-01-02 note Assets:A 5 2024-02-30 gave only P0015 where bean-check reports the misplaced currency or number as well. Now only the errors the date causes are dropped: those starting at or after the line's first bad date, and a dropped directive's whole-node unexpected input, unless the header grammar (first_header_defect, recorded when the converter drops the directive) fails before the date. That last part is needed because rledger reports a dropped balance, event, open or note with one error spanning the whole line, which by itself does not say where the parser failed. Regression rows: test_parse_keeps_a_grammar_error_before_an_invalid_date (both lines, plus open, price and an unclosed custom paren, whose errors are still dropped).
  • One ACCOUNT_TYPES. rustledger-completion re-exports rustledger_core::ACCOUNT_TYPES instead of keeping a copy (it depends on the parser now, and so on core), and the LSP test that guarded the copy is gone.
  • FFI message. parse_date's not-a-date error no longer repeats the input, so FFI reports Invalid date '24-01-15': not a date (...), naming it once.
  • Re-measured: the fuzz table above (1,215 files match beancount's count, from 1,156 on main); real ledgers (1,844 files) unchanged against main, spans included; fuzz replay of 45,973 inputs lossless and green == red; strict baselines unchanged. Merged current main (CHANGELOG conflict only); cache versions 57/73 are still free.

Review round 3

  • Blank or comment lines before a dropped directive. A dropped directive's whole-node error spans from the end of the previous directive, so it started on the blank or comment line, was not placed on the bad-date line, and was kept: 2024-01-01 open Assets:A\n\n2024-01-02 price 2024-02-30 gave 2 errors to bean-check's 1, for open, close, commodity, pad (both orders), balance, note, document, query, event and price. Each dropped directive now records (span start, header start, failure point), with usize::MAX when the header grammar finds no defect, and the header start places the error on its line.
  • Orphan and body lines keep an earlier error. A whole-line recovery error (an orphan indented line, or a transaction-body line no posting takes) has no header grammar, so it is taken to fail at its first token, which matches bean-check: Assets:A 5 USD USD 2024-02-30, "x" 2024-02-30 and a body 5 2024-02-30 report both errors, and 2024-02-30 5 only the date. One more beancount rule surfaced in the probes: an indented line after a blank line, a column-0 comment, or at the top of the file is no directive's continuation, so beancount fails at the indent (unexpected INDENT) and reports that too, even for 2024-02-30 5 and kk: 2024-02-30. That is matched. An indented comment is a continuation and is not a gap.
  • Regression matrix. test_parse_keeps_a_grammar_error_before_an_invalid_date now has 22 rows (the dropped directives, orphan lines and body lines), each checked directly after a directive, after a blank line and after a comment line. All 66 counts, and 23 more probes, equal bean-check 3.2.3's.
  • ACCOUNT_TYPES keeps its type: pub const ACCOUNT_TYPES: &[&str] = &rustledger_core::ACCOUNT_TYPES;.
  • Not fixed: a glued one-letter currency after a bad date (open Assets:C USD 2024-02-30 U,SD) still gives only the date error, where bean-check also reports Invalid token. The header check reports only its earliest defect, which here is the date, so keeping the glued one means emitting a second header error; left for a follow-up.
  • Re-measured: the fuzz table above (1,200 files match beancount's count, from 1,156 on main; round 2 had 1,215: keeping recovery errors before a date moves some fuzz inputs off beancount's count, though every probe shape above matches it); real ledgers (1,844 files) unchanged against main, spans included; fuzz replay of 45,973 inputs lossless and green == red. Merged current main (CHANGELOG conflict only); cache versions 57/73 are still free.

Review round 4

  • A kept whole-node error is reported on its header line. Round 3 used the header start to decide keep or drop, but the kept unexpected input still started at the node span, on the blank or comment line before it: 2024-01-01 open Assets:A\n; c\n2024-01-02 balance Assets:A USD 2024-02-30 gave lines [2, 3] to bean-check's [3, 3]. The error now starts at the header, for every dropped directive. On the 1,844 real ledgers no error line moves (main against this branch, line lists compared).
  • The matrix asserts lines. Every row of test_parse_keeps_a_grammar_error_before_an_invalid_date, in all three placements, now checks each error's line as well as the counts, and the test pins the two round-4 examples ([3, 3] and [3, 3, 4, 4]). All 68 probes match bean-check 3.2.3 on counts and lines.
  • More gaps before an indented line. After option, include, plugin, pushtag, poptag, pushmeta, popmeta or an org-mode * Heading, bean-check reports unexpected INDENT plus the date (option "title" "x"\n 2024-02-30 5 gives 2 errors on line 2). previous_line_is_a_gap now knows them. Still different, and not a date question: kk: 2024-02-30 after one of those undated directives gets no unexpected INDENT here, because rledger reports no error for an indented metadata line there even with a valid date (main is the same).

Review round 5

  • A line inside a multi-line string is never a gap. previous_line_is_a_gap read raw text, so a string continuing on a line that starts with *, ;, or a gap keyword (option x", pushtag y") counted as one, and the indented line after it got an extra error: 2024-01-02 * "multi\n* line"\n 2024-02-30 5 gave [4, 4] to bean-check's [4]. The tree walk now records STRING tokens that run over a line end, and a line starting inside one is not a gap.
  • % and # comments are gaps (bean-check 3.2.3 gives [2, 2] after each; #note with no blank is a tag there, so it is not one).
  • Test rows for those, for pushtag/poptag/pushmeta/popmeta before and after the indented line, and for the four multi-line string cases. All 11 new probes match bean-check on counts and lines; the 1,844 real ledgers give identical error lines against main; the fuzz replay (45,973 inputs) stays lossless with green == red.

Review round 6

  • No gap after a bare marker. Round 5 took a bare # or % line (and an earlier round a bare *) for a comment, so the indented line after it got an unexpected input on the wrong line. To beancount a bare marker is a token. A column-0 comment is now ; and anything, or *, % or # followed by at least one more character on the line, with # not starting a tag (#note, #a.b are tags). Checked against bean-check 3.2.3. !x, &x and :x are comments to beancount too, but rledger already reports an error on those lines (as main does), so they are not gaps here.
  • A multi-line string belongs to the line it starts on. A previous line that starts inside a string now steps back to the line where the string starts (and on, while that line starts inside a string too), and only the no-metadata check applies there: option "title" "a\nb"\n 2024-02-30 5 and the same with plugin, include and pushmeta give unexpected INDENT plus the date, as bean-check does. A transaction's multi-line narration is still no gap.
  • Probes: of 27 marker and string shapes, 16 now match bean-check on error lines (main matches 7). 9 are exactly as on main, where rledger and beancount already differ on the marker line itself (beancount reports a bare marker, or !x, &x, :x, differently on its own line). option "a\nb" "c\nd" then an indented date now gets bean-check's unexpected INDENT and the date on line 4, but not its line-1 option error, which main does not report either. One differs from both: option "title" "a\nb" "c\nd" with an indented line after it gives rledger lines [2, 4, 4], main [2, 4] and bean-check [3, 4], because beancount's error recovery after that option's syntax error swallows the indent. Left for the follow-up issue on contrived input. The test pins the matching rows (lines and counts) and that a bare marker adds nothing.
  • Re-measured: the 1,844 real ledgers give identical error lines against main; the fuzz replay (45,973 inputs) is lossless with green == red.

Review round 7

  • A broken no-metadata directive is no gap. A directive that takes no metadata but is itself a syntax error (option "a" "b" "c", option "title" "a\nb" x, include "a\nb" "c", pushmeta kk: "a\nb" "c") counted as a gap, so the indented line after it got an unexpected INDENT bean-check does not report: beancount's recovery from the broken directive swallows that line. The gap check now requires that no error starts on the directive's lines. A valid plugin "a\nb" "c" still gives [3, 3].
  • #\r, %\r and *\r are comments. flex's . takes the \r, so bean-check 3.2.3 reads them as a marker plus one character. Round 6 trimmed the \r and pinned the wrong answer. That came from my probe harness, which read files in Python text mode and so turned CRLF into LF before beancount saw it. The harness now keeps newlines as they are, and the bean-check CLI agrees: [3, 3].
  • Rows for all of these in the test; all 13 probes match bean-check on lines. The 1,844 real ledgers give identical error lines against main, and the fuzz replay (45,973 inputs) is lossless with green == red.

How to test

  • cargo test -p rustledger-parser --test invalid_value_dates --test stray_char_matrix.
  • cargo test -p rustledger-parser --lib test_report_invalid_dates_is_linear_in_the_input.
  • cargo test -p rustledger-loader --lib char_columns_agree_between_surfaces.
  • cargo test -p rustledger-completion --lib test_classify_after_date_in_every_shape_the_parser_reads.
  • cargo test -p rustledger-ffi-wasi --lib input_entry_to_directive.

Run locally:

  • cargo test --all-features on parser, loader, completion, LSP, CLI and ffi-wasi.
  • cargo check -p rustledger-wasm --target wasm32-unknown-unknown.
  • clippy -D warnings (workspace, all targets), rustdoc -Dwarnings and cargo fmt --check.

Other checks

  • Real files: every in-tree .beancount/.bean plus the compatibility corpus (1,844 files), main against this branch with separate builds. No file's parse errors change, messages included.
  • Strict corpus baselines: corpus_baseline and cst_baseline pass with no row moved.
  • Fuzz corpus: fuzz_parse, fuzz_green_eq_red and fuzz_parse_line, 45,973 inputs. Lossless and green == red hold everywhere.
  • Perf: 279.0M against 277.3M instructions (+0.6%) for rledger check on the 913 KB fava example ledger, measured on the first push.
  • Caches: loader v57, WASM v73.

Closes #2808
Closes #2856

🤖 Generated with Claude Code

…te on its line

beancount's DATE is [0-9]{4,}[-/][0-9]+[-/][0-9]+ with the fields read as
integers, so 02024-01-01, 2024-001-01 and 2024-01-016 are dates there. Our
lexer took \d{4}[-/]\d{1,2}[-/]\d{1,2}: such a header date was an error,
and a value was split into a number expression that #2810/#2817 reported
as a stopgap. The lexer now takes beancount's shape, and one rule,
parse_date_token (via diagnostics::date_fields), decides whether the fields
form a real date (years 1 to 9999). The split-date stopgap
(split_beancount_date, the pushmeta exemption, the 440 pinned matrix rows)
is gone: those rows now match beancount and are checked.

An invalid date is now reported wherever it stands, as beancount reports
it while lexing, and stands for its line (report_invalid_dates, one pass
over the green tree): event, price, transaction header, option, plugin and
orphan lines name the date instead of a generic syntax error; two bad
dates on one line are two errors; bad value dates under a directive with a
bad date of its own are reported too. FFI input dates go through the same
rule (rustledger_parser::parse_date), so year 0 is refused there and an
invalid cost date is an error instead of an undated lot.

Checked against bean-check 3.2.3 on 147 probe files (15 date shapes in 8
positions, the #2856 shapes, header dates): the same lines get parse
errors, with the same counts. No compatibility-corpus or in-tree ledger
changes (1,113 files); strict corpus baselines unchanged; the fuzz corpus
replays clean (45,973 inputs, same 3 pre-existing idempotence cases as
main); about 0.6% more instructions on the 913 KB example ledger.

Loader cache v57, WASM cache v73.

Closes #2808
Closes #2856

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@robcohen
robcohen requested a review from a team as a code owner November 5, 2026 06:06
robcohen and others added 7 commits November 5, 2026 03:54
…ASCII date digits

Review follow-ups on the date rework:

- report_invalid_dates is linear: dates sorted, line bounds from one
  forward pass, errors matched by binary search; counter-based test.
- Diagnostic columns are found through a character-mark table, so many
  errors on one long line no longer make check --format json quadratic.
- A bad date drops only its line's grammar errors; an error covering an
  ERROR_TOKEN (stray character, mid-file BOM) stands, as in beancount. A
  date inside a beancount invalid-token run is not named.
- parse_date takes only text the lexer reads as one DATE token, so
  24-01-15 and 1-1-1 are refused; new leading_date_len shares the rule.
- The DATE regex uses ASCII [0-9], as beancount does.
- An out-of-range date field is named as written, not saturated.
- Completion recognizes every header date shape via leading_date_len.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Review round 2 on the date rework:

- A bad date now drops only the grammar errors it causes: those that start
  at or after the line's first bad date, or a dropped directive's
  whole-node error when the header grammar fails at or after the date.
  An error before the date stands, as in beancount
  (`balance Assets:A USD 2024-02-30`, `note Assets:A 5 2024-02-30`).
- rustledger-completion re-exports rustledger_core::ACCOUNT_TYPES instead
  of keeping a copy; the LSP drift test for the copy is gone.
- parse_date's not-a-date error no longer repeats the input, so the FFI
  message names it once.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ledger/rustledger into fix/dates-extra-digits-as-beancount
…p an orphan line's earlier error

Review round 3 on the date rework:

- A dropped directive's whole-node error spans the blank and comment lines
  before it, so it was not placed on its bad-date line and was kept beside
  the date. Each dropped directive now records its header start and the
  header grammar's failure point (usize::MAX when there is none).
- A whole-line recovery error (an orphan indented line, a body line no
  posting takes) fails at its first token, or at the indent after a blank
  line, a column-0 comment or the top of the file, as beancount does; an
  error from before the date stands.
- The regression test checks 22 rows directly, after a blank line and
  after a comment line, against bean-check 3.2.3's counts.
- rustledger-completion's ACCOUNT_TYPES keeps its `&[&str]` type.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@github-actions

github-actions Bot commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

📊 Benchmark Results

🔴 Slower than base on: investment, fifo

Shape rustledger beancount Speedup RSS (rledger / beancount)
simple 56.1ms ± 2.0ms 731.6ms ± 3.4ms 13.0x 42.5 MB / 51.0 MB
investment 83.7ms ± 2.2ms 2682.6ms ± 20.5ms 32.0x 58.6 MB / 59.0 MB
fifo 80.0ms ± 1.6ms 15923.1ms ± 348.6ms 199.0x 54.6 MB / 59.0 MB

vs base, measured in this run

Shape base this PR Change RSS base → PR
simple 57.7ms ± 2.2ms 56.1ms ± 2.0ms -2.8% ✅ within noise 34.8 MB → 42.5 MB (+21.8%)
investment 79.3ms ± 1.4ms 83.7ms ± 2.2ms +5.6% 🟡 slower 44.9 MB → 58.6 MB (+30.5%)
fifo 76.1ms ± 1.2ms 80.0ms ± 1.6ms +5.2% 🟡 slower 40.9 MB → 54.6 MB (+33.7%)

A difference counts only when it clears the combined spread of the two measurements, per shape (2σ: simple 1.3ms, investment 1.2ms, fifo 0.9ms), and is at least 5%.
10,000 transactions per shape · 20 runs, 3 warmup · hyperfine

What do these numbers mean?
  • simple — Two-posting transfers, one currency. The historical workload — keep as the floor, not as the benchmark.
  • investment — Cost specs, per-unit prices and lot reductions. Exercises booking and inventory, which simple leaves at 0.3%.
  • fifo — Bare {} reductions against a FIFO account — how FIFO sells are normally written. The other four shapes reach the ordered-selection path twice in 2k transactions between them, so it was effectively unprofiled until it turned out to be quadratic (plan_ordered scans every lot per reduction: FIFO ledgers are quadratic (8.8s at 20k transactions) #2083).
  • vs base: the PR and the base-branch commit it is built on, built and measured in the same job
  • RSS: peak resident set size, a single sample — reported without a verdict because there is no spread to test it against
  • A shape with no beancount column is one bean-check reports errors on; it is timed for rledger only

@github-actions

github-actions Bot commented Nov 5, 2026

Copy link
Copy Markdown
Contributor

✅ Compatibility Test Results

Metric Result
Check Compatibility 100%
BQL Compatibility 100% (raw 93%, 179 masked)
Full AST Match 100%
Total Files 826
What's tested
  • Check: Exit codes and error counts match bean-check
  • BQL: Query results match bean-query
    The headline is the EFFECTIVE rate, after pairs where beanquery
    itself is wrong are masked. raw is the same run with nothing
    masked. A widening gap means the registry grew, not that rledger
    changed.
  • Files: ~800 test files downloaded from 10+ beancount repositories

Full results available in workflow artifacts

…nd more indent gaps

Review round 4 on the date rework:

- The whole-node error of a dropped directive now starts at the header,
  not at the blank or comment line its node span takes in, so it is on the
  line bean-check reports.
- An indented line after option, include, plugin, pushtag, poptag,
  pushmeta, popmeta or an org-mode heading is no continuation, so it
  fails at the indent, as in bean-check 3.2.3.
- The regression matrix asserts each error's line as well as the count.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@codecov

codecov Bot commented Nov 5, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 97.55352% with 8 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
crates/rustledger-parser/src/cst/convert.rs 97.66% 6 Missing ⚠️
crates/rustledger-parser/src/diagnostics.rs 88.88% 2 Missing ⚠️

📢 Thoughts on this report? Let us know!

robcohen and others added 2 commits November 5, 2026 07:17
Review round 5 on the date rework:

- previous_line_is_a_gap read raw text, so a multi-line string continuing
  on a line that starts with `*`, `;` or a gap keyword counted as a gap.
  The tree walk now records STRING tokens that run over a line end, and a
  line starting inside one is not a gap.
- `%` and `# ` comment lines are gaps, as in bean-check 3.2.3.
- Test rows for those and for pushtag, poptag, pushmeta and popmeta.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ine for the gap

Review round 6 on the date rework:

- A column-0 comment is `;` and anything, or `*`, `%` or `#` with at least
  one more character on the line and `#` not starting a tag, as in
  bean-check 3.2.3. A bare marker is a token there, so it is no gap.
- A previous line that starts inside a multi-line string steps back to the
  line the string starts on, and only the no-metadata check applies there,
  so an indented line after a multi-line `option`, `plugin`, `include` or
  `pushmeta` value fails at the indent as in beancount.
- Test rows for both.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…r` is a comment

Review round 7 on the date rework:

- A directive that takes no metadata but is itself a syntax error is no
  gap: beancount's recovery from it swallows the indented line after it,
  so it reports no unexpected INDENT there (bean-check 3.2.3).
- `#\r`, `%\r` and `*\r` are comments, as flex's `.` takes the `\r`.
- Test rows for both, including a valid multi-line plugin that still is a
  gap.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@robcohen
robcohen enabled auto-merge (squash) November 5, 2026 14:15
@robcohen
robcohen merged commit 9fe2e2e into main Nov 5, 2026
71 of 72 checks passed
@robcohen
robcohen deleted the fix/dates-extra-digits-as-beancount branch November 5, 2026 14:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant