extern crate proc_macro;
mod renderers;
use regex::Regex;
use syn::parse_macro_input;
#[proc_macro_attribute]
pub fn account_schemas_ix_injector(
args: proc_macro::TokenStream,
input: proc_macro::TokenStream,
) -> proc_macro::TokenStream {
let args_str = args.to_string();
let accounts = Regex::new(r"\s|\n|\t|,")
.unwrap()
.split(args_str.as_str())
.collect::<Vec<&str>>()
.iter()
.filter_map(|s| {
if s.is_empty() {
None
} else {
Some(s.to_string())
}
})
.collect::<Vec<String>>();
let program = parse_macro_input!(input as syn::ItemMod);
renderers::AccountSchemaInstructionInjectors::new(program, accounts).render()
}