File tree Expand file tree Collapse file tree 1 file changed +11
-12
lines changed
crates/parser/src/grammar Expand file tree Collapse file tree 1 file changed +11
-12
lines changed Original file line number Diff line number Diff line change @@ -70,16 +70,9 @@ pub(super) fn item_or_macro(p: &mut Parser<'_>, stop_on_r_curly: bool) {
7070 // macro_rules! {};
7171 // macro_rules! ()
7272 // macro_rules! []
73- if paths:: is_use_path_start ( p)
74- || ( p. at_contextual_kw ( T ! [ macro_rules] ) && p. nth_at ( 1 , BANG ) && !p. nth_at ( 2 , IDENT ) )
75- {
76- match macro_call ( p) {
77- BlockLike :: Block => ( ) ,
78- BlockLike :: NotBlock => {
79- p. expect ( T ! [ ; ] ) ;
80- }
81- }
82- m. complete ( p, MACRO_CALL ) ;
73+ let no_ident = p. at_contextual_kw ( T ! [ macro_rules] ) && p. nth_at ( 1 , BANG ) && !p. nth_at ( 2 , IDENT ) ;
74+ if paths:: is_use_path_start ( p) || no_ident {
75+ macro_call ( p, m) ;
8376 return ;
8477 }
8578
@@ -436,10 +429,16 @@ fn fn_(p: &mut Parser<'_>, m: Marker) {
436429 m. complete ( p, FN ) ;
437430}
438431
439- fn macro_call ( p : & mut Parser < ' _ > ) -> BlockLike {
432+ fn macro_call ( p : & mut Parser < ' _ > , m : Marker ) {
440433 assert ! ( paths:: is_use_path_start( p) ) ;
441434 paths:: use_path ( p) ;
442- macro_call_after_excl ( p)
435+ match macro_call_after_excl ( p) {
436+ BlockLike :: Block => ( ) ,
437+ BlockLike :: NotBlock => {
438+ p. expect ( T ! [ ; ] ) ;
439+ }
440+ }
441+ m. complete ( p, MACRO_CALL ) ;
443442}
444443
445444pub ( super ) fn macro_call_after_excl ( p : & mut Parser < ' _ > ) -> BlockLike {
You can’t perform that action at this time.
0 commit comments