1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#![warn(missing_docs)]
use syn::{parse::Parse, parse_macro_input};
extern crate proc_macro;
mod gen;
mod parse;
#[allow(missing_docs)]
#[proc_macro]
pub fn compound(item: proc_macro::TokenStream) -> proc_macro::TokenStream {
struct Wrapper(parse::Compound);
impl Parse for Wrapper {
fn parse(input: syn::parse::ParseStream) -> syn::Result<Self> {
parse::Compound::parse_terminated(input).map(|punctuated| Wrapper(punctuated))
}
}
let input = parse_macro_input!(item as Wrapper).0;
gen::gen_compound_expr(&input).into()
}