peginator_macro

Crates.iopeginator_macro
lib.rspeginator_macro
version0.7.0
sourcesrc
created_at2022-05-18 15:45:14.917047
updated_at2024-02-11 09:18:57.907311
descriptionConvenience macros for using peginator (a PEG parser generator)
homepage
repositoryhttps://github.com/badicsalex/peginator
max_upload_size
id589080
size3,751
Alex Badics (badicsalex)

documentation

https://docs.rs/peginator_macro

README

Peginator macro

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);
}
Commit count: 211

cargo fmt