20 lines
418 B
Rust
20 lines
418 B
Rust
|
#![recursion_limit = "1024"]
|
||
|
|
||
|
extern crate proc_macro;
|
||
|
extern crate syn;
|
||
|
#[macro_use]
|
||
|
extern crate quote;
|
||
|
|
||
|
mod util;
|
||
|
mod enums;
|
||
|
|
||
|
use proc_macro::TokenStream;
|
||
|
|
||
|
#[proc_macro_derive(GraphQLEnum, attributes(graphql))]
|
||
|
pub fn derive_enum(input: TokenStream) -> TokenStream {
|
||
|
let s = input.to_string();
|
||
|
let ast = syn::parse_derive_input(&s).unwrap();
|
||
|
let gen = enums::impl_enum(&ast);
|
||
|
gen.parse().unwrap()
|
||
|
}
|