Skip to content
Snippets Groups Projects
Commit 6272e89b authored by Per Lindgren's avatar Per Lindgren
Browse files

polish

parent d5be3391
No related branches found
No related tags found
No related merge requests found
......@@ -3,27 +3,31 @@ extern crate proc_macro;
use proc_macro::TokenStream;
use proc_macro2::TokenStream as TokenStream2;
use syn::{
braced, parenthesized,
parse::{self, Parse, ParseStream, Parser},
token::Brace,
Ident, Item, LitInt, Token,
// braced, parenthesized,
// parse::{self, Parse, ParseStream, Parser},
parse,
// token::Brace,
// Ident,
Item,
// LitInt,
// Token,
};
#[proc_macro_attribute]
pub fn my_attribute(args: TokenStream, input: TokenStream) -> TokenStream {
eprintln!("--- args {:?}", args);
eprintln!("--- input {:?}", input);
// eprintln!("--- args {:?}", args);
// eprintln!("--- input {:?}", input);
let r = app(args.into(), input.into());
r.unwrap()
}
fn app(args: TokenStream2, input: TokenStream2) -> parse::Result<TokenStream> {
fn app(_args: TokenStream2, input: TokenStream2) -> parse::Result<TokenStream> {
match syn::parse2(input.clone())? {
Item::Fn(f) => {
Item::Fn(_f) => {
eprintln!("we found a function");
}
Item::Struct(s) => {
Item::Struct(_s) => {
eprintln!("we found a struct");
}
_ => unimplemented!("case not covered"),
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment