Init commit

This commit is contained in:
Markus Scully 2024-11-14 20:56:28 +00:00
commit 3a9f283e99
No known key found for this signature in database
GPG key ID: B8470B38660AF9E8
13 changed files with 418 additions and 0 deletions

View file

@ -0,0 +1,14 @@
[package]
name = "autolingual-macro"
version = "0.1.0"
edition = "2021"
license = "MIT"
description = "Procedural macros for autolingual"
[lib]
proc-macro = true
[dependencies]
proc-macro2 = "1.0"
quote = "1.0"
syn = { version = "2.0", features = ["full"] }

View file

@ -0,0 +1,18 @@
use proc_macro::TokenStream;
use quote::quote;
use syn::{parse_macro_input, LitStr};
#[proc_macro]
pub fn translate(input: TokenStream) -> TokenStream {
let input = parse_macro_input!(input as LitStr);
let text = input.value();
// TODO: Implement actual translation logic
quote! {
::autolingual::TranslationSet {
en: #text,
fr: "TODO",
}
}.into()
}