Creates a single function to call for the upcoming macro shim library. This should centralise logic in the library crate rather than the proc_macro
crate, which should make things substantially easier to develop and test.
5FIVUZYFLOZ2CCH4GCOQQZFL3GDEB23VJ7J6YUXQDZQEAQDB76DQC
OCR4YRQ2LXK3PXSWPEWCBED4DFVMXZIF4RS35XQZSJ2D2KEIB2VQC
XGNME3WRU3MJDTFHUFJYARLVXWBZIH5ODBOIIFTXHNCBTZQH2R7QC
QSK7JRBA55ZRY322WXGNRROJL7NTFBR6MJPOOA5B2XD2JAVM4MWQC
UOMQT7LTURIIWHZT2ZHLCJG6XESYTN26EJC7IHRFR4PYJ355PNYAC
5TEX4MNUC4LDDRMNEOVCFNUUEZAGUXMKO3OIEQFXWRQKXSHY2NRQC
O77KA6C4UJGZXVGPEA7WCRQH6XYQJPWETSPDXI3VOKOSRQND7JEQC
enum_data: syn::DataEnum,
) -> proc_macro2::TokenStream {
let mut idents = Vec::with_capacity(enum_data.variants.len());
let mut messages = Vec::with_capacity(enum_data.variants.len());
variants: Punctuated<syn::Variant, syn::token::Comma>,
) -> TokenStream {
let mut idents = Vec::with_capacity(variants.len());
let mut messages = Vec::with_capacity(variants.len());
pub fn attribute_groups(attribute: syn::Attribute) -> Group {
match attribute.meta {
syn::Meta::List(list_data) => {
let path_literal: syn::LitStr = syn::parse2(list_data.tokens).unwrap();
pub fn attribute_groups(path_literal: syn::LitStr) -> Group {
// Read the fluent file at the given path
let manifest_root = std::env::var("CARGO_MANIFEST_DIR").unwrap();
let resource_path = PathBuf::from(manifest_root).join(path_literal.value());
let fluent_contents = std::fs::read_to_string(resource_path).unwrap();
// Read the fluent file at the given path
let manifest_root = std::env::var("CARGO_MANIFEST_DIR").unwrap();
let resource_path = PathBuf::from(manifest_root).join(path_literal.value());
let fluent_contents = std::fs::read_to_string(resource_path).unwrap();
// Parse the file into a `Group`
let resource = fluent_syntax::parser::parse(fluent_contents).unwrap();
let group = Group::from_resource(resource);
group
}
syn::Meta::Path(_) => todo!(),
syn::Meta::NameValue(_) => todo!(),
}
pub fn localize(
path: syn::LitStr,
ident: syn::Ident,
variants: Punctuated<syn::Variant, syn::token::Comma>,
) -> TokenStream {
let group = attribute_groups(path);
derive_enum(group, ident, variants)