mirror of
https://codeberg.org/unspeaker/tengri.git
synced 2025-12-06 11:46:42 +01:00
This commit is contained in:
parent
b543c43e68
commit
cba23a005c
3 changed files with 417 additions and 34 deletions
|
|
@ -1,26 +1,31 @@
|
|||
extern crate proc_macro;
|
||||
use proc_macro::TokenStream;
|
||||
use proc_macro2::{TokenStream as TokenStream2};
|
||||
|
||||
pub(crate) use std::collections::{HashMap, BTreeMap};
|
||||
pub(crate) use std::cmp::Ordering;
|
||||
pub(crate) use proc_macro::TokenStream;
|
||||
pub(crate) use proc_macro2::{
|
||||
TokenStream as TokenStream2, TokenTree,
|
||||
Ident, Span, Punct, Spacing::*, Group, Delimiter, Literal
|
||||
};
|
||||
pub(crate) use syn::{
|
||||
parse, parse_macro_input, parse_quote as pq,
|
||||
braced, bracketed, parenthesized, Token,
|
||||
Arm, Expr, Attribute, Meta, MetaList, Path, PathSegment, PathArguments, ImplItem, LitStr, Type,
|
||||
parse::{Parse, ParseStream, Result},
|
||||
token::{PathSep, Brace},
|
||||
punctuated::Punctuated,
|
||||
};
|
||||
pub(crate) use quote::{quote, TokenStreamExt, ToTokens};
|
||||
|
||||
mod proc_view;
|
||||
mod proc_expose;
|
||||
|
||||
#[proc_macro_attribute]
|
||||
pub fn view (meta: TokenStream, item: TokenStream) -> TokenStream {
|
||||
self::proc_view::view_impl(meta.into(), item.into()).into()
|
||||
//for attr in syn::parse_macro_input!(meta as syn::MetaList).iter() {
|
||||
//}
|
||||
//let item = syn::parse_macro_input!(item as syn::ItemImpl);
|
||||
//let output = "TuiOut";
|
||||
//let target = "Tek";
|
||||
//let define = "self.config.view";
|
||||
//let expose = vec![];
|
||||
//let output = format!(
|
||||
//"::tengri_dsl::view!({}:|self:{}|self.size.of(::tengri_dsl::View(self,{}));{{{}}});",
|
||||
//output,
|
||||
//target,
|
||||
//define,
|
||||
//expose.iter().fold(String::new(), |acc, (key, value)|format!("{acc},{key}=>{value}")),
|
||||
//);
|
||||
//let output = "";
|
||||
//output.parse().unwrap()
|
||||
}
|
||||
|
||||
#[proc_macro_attribute]
|
||||
pub fn expose (meta: TokenStream, item: TokenStream) -> TokenStream {
|
||||
self::proc_expose::expose_impl(meta.into(), item.into()).into()
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue