Skip to content

Add shopping list parser and serializer#89

Open
dubadub wants to merge 4 commits intomainfrom
feat/shopping-list-parser
Open

Add shopping list parser and serializer#89
dubadub wants to merge 4 commits intomainfrom
feat/shopping-list-parser

Conversation

@dubadub
Copy link
Member

@dubadub dubadub commented Feb 5, 2026

Summary

  • Add new shopping_list module behind a shopping_list feature flag (enabled by default)
  • Parse and serialize a tree-structured shopping list format with recipe references (./path{multiplier}) and free-hand ingredients (name{qty%unit})
  • Support nested items via 2-space indentation, comments (//), bare ingredients, and fractional multipliers

Format

./Breakfast/Easy Pancakes{2}
  ./Some/Nested Recipe{2}
free hand ingredient{4%l}
salt

API

  • shopping_list::parse(input) -> Result<ShoppingList, ShoppingListError> — strict parser
  • shopping_list::write(list, writer) -> io::Result<()> — serializer (round-trip tested)
  • ShoppingListError implements RichError for annotated error reporting
  • All types implement Serialize/Deserialize

Test plan

  • 19 unit tests covering basic parsing, nesting, round-trip serialization, and error cases
  • Full test suite passes (cargo test --all-features, excluding pre-existing serde_test failure)
  • No new clippy warnings

@pkg-pr-new
Copy link

pkg-pr-new bot commented Feb 5, 2026

commit: ed8f171

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant