@@ -9,10 +9,12 @@ mod util;
99
1010use proc_macro2:: TokenStream as TokenStream2 ;
1111use syn:: {
12- braced, parenthesized,
12+ braced,
13+ group:: parse_parens,
14+ parenthesized,
1315 parse:: { self , Parse , ParseStream , Parser } ,
1416 token:: Brace ,
15- Ident , Item , LitBool , LitInt , Token ,
17+ Ident , Item , LitBool , LitInt , Path , Token ,
1618} ;
1719
1820use crate :: {
@@ -368,14 +370,22 @@ fn task_args(
368370 . parse2 ( tokens)
369371}
370372
371- fn monotonic_args ( tokens : TokenStream2 ) -> parse:: Result < MonotonicArgs > {
373+ fn monotonic_args ( path : Path , tokens : TokenStream2 ) -> parse:: Result < MonotonicArgs > {
372374 ( |input : ParseStream < ' _ > | -> parse:: Result < MonotonicArgs > {
373375 let mut binds = None ;
374376 let mut priority = None ;
375377 let mut default = None ;
376378
377- let content;
378- parenthesized ! ( content in input) ;
379+ let content = match parse_parens ( input) {
380+ Ok ( parens) => parens. content ,
381+ Err ( _) => {
382+ return Err ( parse:: Error :: new (
383+ path. segments . first ( ) . unwrap ( ) . ident . span ( ) ,
384+ "expected opening ( in #[monotonic( ... )]" ,
385+ ) ) ;
386+ }
387+ } ;
388+
379389 if !content. is_empty ( ) {
380390 loop {
381391 // Parse identifier name
@@ -450,6 +460,7 @@ fn monotonic_args(tokens: TokenStream2) -> parse::Result<MonotonicArgs> {
450460 let _: Token ! [ , ] = content. parse ( ) ?;
451461 }
452462 }
463+
453464 let binds = if let Some ( r) = binds {
454465 r
455466 } else {
0 commit comments