#peg-parser #peg

macro peginator_macro

Convenience macros for using peginator (a PEG parser generator)

12 releases

0.7.0 Feb 11, 2024
0.6.0 Nov 28, 2022
0.5.1 Nov 28, 2022
0.2.0 Jul 17, 2022

#40 in #peg

Download history 8/week @ 2024-07-15 23/week @ 2024-07-22 72/week @ 2024-07-29 9/week @ 2024-08-19 22/week @ 2024-08-26 8/week @ 2024-09-02 27/week @ 2024-09-09 55/week @ 2024-09-16 56/week @ 2024-09-23

107 downloads per month
Used in 3 crates (via bpf-script)

MIT license

275KB
6.5K SLoC

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);
}

Dependencies

~0.5–11MB
~63K SLoC