File tree 1 file changed +20
-7
lines changed
1 file changed +20
-7
lines changed Original file line number Diff line number Diff line change @@ -2911,15 +2911,28 @@ impl<'a> Parser<'a> {
2911
2911
pat = PatRange ( start, end) ;
2912
2912
} else if is_plain_ident ( & self . token ) && !can_be_enum_or_struct {
2913
2913
let name = self . parse_path ( NoTypesAllowed ) . path ;
2914
- let sub;
2915
- if self . eat ( & token:: AT ) {
2916
- // parse foo @ pat
2917
- sub = Some ( self . parse_pat ( ) ) ;
2914
+ if self . eat ( & token:: NOT ) {
2915
+ // macro invocation
2916
+ let ket = token:: close_delimiter_for ( & self . token )
2917
+ . unwrap_or_else ( || self . fatal ( "expected open delimiter" ) ) ;
2918
+ self . bump ( ) ;
2919
+
2920
+ let tts = self . parse_seq_to_end ( & ket,
2921
+ seq_sep_none ( ) ,
2922
+ |p| p. parse_token_tree ( ) ) ;
2923
+
2924
+ let mac = MacInvocTT ( name, tts, EMPTY_CTXT ) ;
2925
+ pat = ast:: PatMac ( codemap:: Spanned { node : mac, span : self . span } ) ;
2918
2926
} else {
2919
- // or just foo
2920
- sub = None ;
2927
+ let sub = if self . eat ( & token:: AT ) {
2928
+ // parse foo @ pat
2929
+ Some ( self . parse_pat ( ) )
2930
+ } else {
2931
+ // or just foo
2932
+ None
2933
+ } ;
2934
+ pat = PatIdent ( BindByValue ( MutImmutable ) , name, sub) ;
2921
2935
}
2922
- pat = PatIdent ( BindByValue ( MutImmutable ) , name, sub) ;
2923
2936
} else {
2924
2937
// parse an enum pat
2925
2938
let enum_path = self . parse_path ( LifetimeAndTypesWithColons )
You can’t perform that action at this time.
0 commit comments