Init commit
This commit is contained in:
commit
3a9f283e99
13 changed files with 418 additions and 0 deletions
14
autolingual-macro/Cargo.toml
Normal file
14
autolingual-macro/Cargo.toml
Normal 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"] }
|
18
autolingual-macro/src/lib.rs
Normal file
18
autolingual-macro/src/lib.rs
Normal 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()
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue