refactor!(formula): migrate parser to use pest

Replace the manual tokenizer and recursive descent parser with a PEG
grammar using the pest library.

This migration involves introducing a formal grammar in formula.pest and
updating the parser implementation to utilize the generated Pest parser
with a tree-walking approach to construct the AST.

The change introduces a stricter requirement for identifiers: multi-word
identifiers must now be enclosed in pipe quotes (e.g., |Total Revenue|) and
are no longer accepted as bare words.

Tests have been updated to reflect the new parsing logic, remove
tokenizer-specific tests, and verify the new pipe-quoting and escape
semantics.

BREAKING CHANGE: Multi-word identifiers now require pipe-quoting (e.g. |Total Revenue|) and
are no longer accepted as bare words.
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:04:57 -07:00
parent 38f83b2417
commit 3f69f88709
4 changed files with 404 additions and 446 deletions

2
Cargo.lock generated
View File

@ -756,6 +756,8 @@ name = "improvise-formula"
version = "0.1.0-rc2"
dependencies = [
"anyhow",
"pest",
"pest_derive",
"serde",
]