repl_framework_proc_macros/
lib.rs

1extern crate proc_macro;
2use proc_macro::TokenStream;
3
4#[proc_macro_attribute]
5pub fn replify(_attr: TokenStream, input: TokenStream) -> TokenStream {
6    let mut code = String::new();
7    let mut last_char = ' ';
8    let mut times = 0;
9    for i in input.to_string().chars() {
10        if last_char == '(' && times == 0 {
11            code.push_str("_data: std::collections::HashMap<String, std::sync::Arc<dyn std::any::Any>>,");
12            times += 1
13        };
14        code.push(i);
15        last_char = i;
16    }
17    code.parse().unwrap()
18}