From ccecd4bc03be8c29a85e86bdae2e6faac12a4758 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Fri, 10 May 2024 14:01:51 +0100 Subject: [PATCH] W --- macros/macros.rs | 31 ++++++++++++++++++------------- 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/macros/macros.rs b/macros/macros.rs index 8aa4032..b532ce7 100644 --- a/macros/macros.rs +++ b/macros/macros.rs @@ -9,20 +9,25 @@ pub fn dbg_dump(input: TokenStream) -> TokenStream { #[proc_macro] pub fn reconstruct_groups(input: TokenStream) -> TokenStream { - let mut output = TokenStream::new(); - dbg!(&input); - for tt in input { - let tt = match tt { - TokenTree::Group(g) => { - let delim = g.delimiter(); - dbg!(&delim); - let stream = reconstruct_groups(g.stream()); - TokenTree::Group(Group::new(delim, stream)) - }, - other => other, - }; - output.extend([tt]); + fn recurse(input: TokenStream) -> TokenStream { + let mut output = TokenStream::new(); + for tt in input { + let tt = match tt { + TokenTree::Group(g) => { + let delim = g.delimiter(); + dbg!(&delim); + let stream = reconstruct_groups(g.stream()); + TokenTree::Group(Group::new(delim, stream)) + }, + other => other, + }; + output.extend([tt]); + } + output } + + dbg!(&input); + let output = recurse(input); dbg!(&output); dbg!(&output.to_string()); output -- 2.30.2