Revert "Replace some manual parsing code with darling helper crate"

This reverts commit e5af4f8efe.

The `darling` crate limits us to `syn::Meta` which is probably not
enough in the long run. There are a couple of other problems I have
with this crate and I think it's currently not worth. I'm considering
writing my own alternative...
This commit is contained in:
Lukas Kalbertodt
2021-11-03 14:58:23 +01:00
parent e5af4f8efe
commit a54042f8ca
4 changed files with 270 additions and 200 deletions

View File

@@ -3,19 +3,14 @@ use proc_macro::TokenStream as TokenStream1;
mod gen;
mod ir;
mod parse;
mod util;
#[proc_macro_derive(Config, attributes(config))]
pub fn config(input: TokenStream1) -> TokenStream1 {
let input = match syn::parse2::<syn::DeriveInput>(input.into()) {
Err(e) => return e.to_compile_error().into(),
Ok(i) => i,
};
ir::Input::from_ast(input)
syn::parse2::<syn::DeriveInput>(input.into())
.and_then(ir::Input::from_ast)
.map(gen::gen)
.unwrap_or_else(|e| e.write_errors())
.unwrap_or_else(|e| e.to_compile_error())
.into()
}