From b115605055e72c5a261f9f024d7db8f508517fc9 Mon Sep 17 00:00:00 2001 From: Ashelyn Rose Date: Sun, 20 Apr 2025 11:49:00 -0600 Subject: Started proc_macro parsing - DOES NOT WORK --- modules/morgana_proc/Cargo.toml | 9 +++++++++ modules/morgana_proc/src/lib.rs | 21 +++++++++++++++++++++ 2 files changed, 30 insertions(+) create mode 100644 modules/morgana_proc/Cargo.toml create mode 100644 modules/morgana_proc/src/lib.rs (limited to 'modules/morgana_proc') diff --git a/modules/morgana_proc/Cargo.toml b/modules/morgana_proc/Cargo.toml new file mode 100644 index 0000000..fb1e28a --- /dev/null +++ b/modules/morgana_proc/Cargo.toml @@ -0,0 +1,9 @@ +[package] +name = "morgana_proc" +edition = "2021" + +[lib] +proc-macro = true + +[dependencies] +unsynn = "0.0.26" diff --git a/modules/morgana_proc/src/lib.rs b/modules/morgana_proc/src/lib.rs new file mode 100644 index 0000000..f4932d6 --- /dev/null +++ b/modules/morgana_proc/src/lib.rs @@ -0,0 +1,21 @@ +extern crate proc_macro; + +use unsynn::*; + +#[proc_macro] +pub fn morx(input: proc_macro::TokenStream) -> proc_macro::TokenStream { + println!("{:?}", input); + let ast: MorxBlock = unsynn::TokenStream::from(input).to_token_iter().parse_all().unwrap(); + + LiteralString::from_str("test").to_token_stream().into() +} + + +unsynn! { + struct MorxBlock(Any>, Nothing>); + struct MorxNode(Ident, MorxChildren); + struct MorxAttr(Either); + struct MorxComplexAttr(Ident, Assign, AttrValue); + struct AttrValue(Either); + struct MorxChildren(Either>>); +} -- cgit 1.4.1