Crates.io | peginator_macro |
lib.rs | peginator_macro |
version | 0.7.0 |
source | src |
created_at | 2022-05-18 15:45:14.917047 |
updated_at | 2024-02-11 09:18:57.907311 |
description | Convenience macros for using peginator (a PEG parser generator) |
homepage | |
repository | https://github.com/badicsalex/peginator |
max_upload_size | |
id | 589080 |
size | 3,751 |
Proc-macro support for peginator. Please find documentation and other goodies on the main project.
Usage:
use peginator_macro::peginate;
use peginator::PegParser;
peginate!("
@export
PizzaRule =
'Pizza' 'with'
toppings:Topping
{',' toppings:Topping}
['and' toppings:Topping]
;
@string
Topping = 'sausage' | 'pineapple' | 'bacon' | 'cheese';
");
fn main() {
let result = PizzaRule::parse("Pizza with sausage, bacon and cheese").unwrap();
println!("{:?}", result.toppings);
}