v0.2.4 — trivia foundation + error-message DSL + docs
Three-part release.
Trivia attribution foundation
Intra-sequence trivia now attaches to the following sibling's leadingTrivia rather than being dropped. Threaded through the engine and generator via a pendingLeadingTrivia field with save/restore across backtracking combinators (Choice / Optional / And / Not / ZeroOrMore / OneOrMore / Repetition).
Deferred: full source round-trip (RoundTripTest 22/22) still requires rule-exit pos rewind, which would shift NonTerminal span ends and regenerate CstHash baselines. Intentionally out of scope for this release; scheduled for a subsequent patch. RoundTripTest remains @Disabled. See docs/TRIVIA-ATTRIBUTION.md.
Error-message DSL
Four new grammar directives, all optional:
%expected "label"(rule-level) — semantic expected-label for failure diagnostics.%recover <terminator>(rule-level) — ADVANCED-recovery point override.%suggest <RuleName>(grammar-level) — Levenshtein-distance hints from a designated vocabulary.%tag "tag"(rule-level) — machine-readable tag on emitted diagnostics.
Diagnostic#tag() field added. Built-in tags: error.unexpected-input, error.expected, error.unclosed.
Suggestion vocabulary is cached at ParsingContext construction for forward compatibility with 0.3.1 incremental parsing.
Documentation pass
docs/TRIVIA-ATTRIBUTION.md— attribution rule + deferred round-trip.docs/GRAMMAR-DSL.md— cut-operator edge cases +%expected/%recover/%suggest/%tag.docs/PERF-FLAGS.md— tabular reference for all 10ParserConfigperf flags from 0.2.2.docs/BENCHMARKING.md— JMH harness usage and extension guide.docs/ERROR_RECOVERY.mdexpanded with diagnostic tags and%recoveroverride.- README cross-linked to all new reference docs.
Breaking changes
None. Grammars without the new directives produce byte-identical generator output (GeneratorFlagInertnessTest 3/3 green). ParserConfig API unchanged. All ten corpus-parity suites stay 22/22 against unchanged baselines.
Tests
587 → 601 passing, 1 skipped (RoundTripTest), 0 failures, 0 errors. New suites: SemanticExpectedTest (3), RuleRecoveryTest (3), SuggestionTest (3), DiagnosticTagTest (5).