1 // SPDX-License-Identifier: GPL-2.0 2 3 use proc_macro2::{ 4 Ident, 5 TokenStream, 6 TokenTree, // 7 }; 8 use syn::{ 9 parse::{ 10 Parse, 11 ParseStream, // 12 }, 13 Result, 14 Token, // 15 }; 16 17 pub(crate) struct Input { 18 a: Ident, 19 _comma: Token![,], 20 b: Ident, 21 } 22 23 impl Parse for Input { 24 fn parse(input: ParseStream<'_>) -> Result<Self> { 25 Ok(Self { 26 a: input.parse()?, 27 _comma: input.parse()?, 28 b: input.parse()?, 29 }) 30 } 31 } 32 33 pub(crate) fn concat_idents(Input { a, b, .. }: Input) -> TokenStream { 34 let res = Ident::new(&format!("{a}{b}"), b.span()); 35 TokenStream::from_iter([TokenTree::Ident(res)]) 36 } 37