Shopping List Parser
Description
This project is a shopping_list_parser designed for educational purposes. It allows you to parse a structured list of shopping items using a grammar defined in pest.
Example Usage
An example of a shopping list that can be parsed by this grammar:
1. Apples 5 pcs
2. Bananas 3 kg
3. Mango 1 pcs
Features
- Parses a structured shopping list with items, quantities, and units
- Uses the
pestparser generator library to define the grammar - Provides a simple API to parse the shopping list
Getting Started
Prerequisites
- Rust programming language
- Cargo package manager
Usage
-
Import the
shopping_list_parsercrate in your Rust project:use parse_shopping_list; -
Call the
parse_shopping_listfunction with a string containing the shopping list:let input = "1. Apples 5 pcs\n2. Bananas 3 kg\n3. Mango 1 pcs"; parse_shopping_list?;The function will parse the input and return a
Resultcontaining any parsing errors.