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 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
extern crate bytecount; extern crate glob; #[macro_use] extern crate proc_macro_hack; extern crate proc_macro; extern crate proc_macro2; extern crate pulldown_cmark; #[macro_use] extern crate quote; #[macro_use] extern crate syn; mod config; mod extract; mod render; mod tree; use config::Config; use render::RenderContext; proc_macro_item_impl! { pub fn doubter_impl(input: &str) -> String { doubter_impl_inner(input).to_string() } } fn doubter_impl_inner(input: &str) -> proc_macro2::TokenStream { let config: Config = input.parse().unwrap_or_else(|e| { panic!("failed to parse the input: {}", e); }); let ctx = RenderContext::init(config).unwrap_or_else(|e| { panic!("failed to initialize the render context: {}", e); }); let mut tokens = Default::default(); ctx.render(&mut tokens).unwrap_or_else(|e| { panic!("error during generating doc comments: {}", e); }); tokens }