diff options
-rw-r--r-- | src/lib.rs | 4 | ||||
-rw-r--r-- | tests/test.rs | 14 |
2 files changed, 18 insertions, 0 deletions
@@ -715,6 +715,10 @@ macro_rules! quote_token_with_context { }}; ($tokens:ident $span:ident $b3:tt $b2:tt # (( $($inner:tt)* )) $sep:tt * $a3:tt) => {}; ($tokens:ident $span:ident $b3:tt # ( $($inner:tt)* ) ($sep:tt) * $a2:tt $a3:tt) => {}; + ($tokens:ident $span:ident # ( $($inner:tt)* ) * (*) $a1:tt $a2:tt $a3:tt) => { + // https://github.com/dtolnay/quote/issues/130 + $crate::quote_token!($tokens $span *); + }; ($tokens:ident $span:ident # ( $($inner:tt)* ) $sep:tt (*) $a1:tt $a2:tt $a3:tt) => {}; ($tokens:ident $span:ident $b3:tt $b2:tt $b1:tt (#) $var:ident $a2:tt $a3:tt) => { diff --git a/tests/test.rs b/tests/test.rs index 6421172..957d470 100644 --- a/tests/test.rs +++ b/tests/test.rs @@ -413,3 +413,17 @@ fn test_inner_attr() { let expected = "# ! [ no_std ]"; assert_eq!(expected, tokens.to_string()); } + +// https://github.com/dtolnay/quote/issues/130 +#[test] +fn test_star_after_repetition() { + let c = vec!['0', '1']; + let tokens = quote! { + #( + f(#c); + )* + *out = None; + }; + let expected = "f ( '0' ) ; f ( '1' ) ; * out = None ;"; + assert_eq!(expected, tokens.to_string()); +} |