refactor(formula): trust grammar invariants in parser

Refactor the formula parser to assume grammar invariants, replacing
Result-based error handling in tree walkers with infallible functions and
.expect(GRAMMAR_INVARIANT) calls.

This simplification is based on the guarantee that the Pest grammar already
validates the input structure. To verify these invariants and ensure
correctness, extensive new unit tests and property-based tests using
proptest have been added.

Co-Authored-By: fiddlerwoaroof/git-smart-commit (gemma-4-31B-it-UD-Q4_K_XL.gguf)
This commit is contained in:
Edward Langley
2026-04-15 04:32:14 -07:00
parent dba8a5269e
commit 5fbc73269f
3 changed files with 607 additions and 170 deletions

View File

@ -11,3 +11,7 @@ anyhow = "1"
pest = "2.8.6"
pest_derive = "2.8.6"
serde = { version = "1", features = ["derive"] }
[dev-dependencies]
pest_meta = "2.8.6"
proptest = "1"