@@ -436,43 +436,40 @@ pub fn parse(sess: &ParseSess, rdr: TtReader, ms: &[TokenTree]) -> NamedParseRes
436
436
} else {
437
437
return Failure ( parser. span , token:: Eof ) ;
438
438
}
439
- } else {
440
- if ( !bb_eis. is_empty ( ) && !next_eis. is_empty ( ) )
441
- || bb_eis. len ( ) > 1 {
442
- let nts = bb_eis. iter ( ) . map ( |ei| match ei. top_elts . get_tt ( ei. idx ) {
443
- TokenTree :: Token ( _, MatchNt ( bind, name) ) => {
444
- format ! ( "{} ('{}')" , name, bind)
445
- }
446
- _ => panic ! ( )
447
- } ) . collect :: < Vec < String > > ( ) . join ( " or " ) ;
448
-
449
- return Error ( parser. span , format ! (
450
- "local ambiguity: multiple parsing options: {}" ,
451
- match next_eis. len( ) {
452
- 0 => format!( "built-in NTs {}." , nts) ,
453
- 1 => format!( "built-in NTs {} or 1 other option." , nts) ,
454
- n => format!( "built-in NTs {} or {} other options." , nts, n) ,
455
- }
456
- ) )
457
- } else if bb_eis. is_empty ( ) && next_eis. is_empty ( ) {
458
- return Failure ( parser. span , parser. token ) ;
459
- } else if !next_eis. is_empty ( ) {
460
- /* Now process the next token */
461
- cur_eis. extend ( next_eis. drain ( ..) ) ;
462
- parser. bump ( ) ;
463
- } else /* bb_eis.len() == 1 */ {
464
- let mut ei = bb_eis. pop ( ) . unwrap ( ) ;
465
- if let TokenTree :: Token ( span, MatchNt ( _, ident) ) = ei. top_elts . get_tt ( ei. idx ) {
466
- let match_cur = ei. match_cur ;
467
- ei. matches [ match_cur] . push ( Rc :: new ( MatchedNonterminal (
468
- Rc :: new ( parse_nt ( & mut parser, span, & ident. name . as_str ( ) ) ) ) ) ) ;
469
- ei. idx += 1 ;
470
- ei. match_cur += 1 ;
471
- } else {
472
- unreachable ! ( )
439
+ } else if ( !bb_eis. is_empty ( ) && !next_eis. is_empty ( ) ) || bb_eis. len ( ) > 1 {
440
+ let nts = bb_eis. iter ( ) . map ( |ei| match ei. top_elts . get_tt ( ei. idx ) {
441
+ TokenTree :: Token ( _, MatchNt ( bind, name) ) => {
442
+ format ! ( "{} ('{}')" , name, bind)
443
+ }
444
+ _ => panic ! ( )
445
+ } ) . collect :: < Vec < String > > ( ) . join ( " or " ) ;
446
+
447
+ return Error ( parser. span , format ! (
448
+ "local ambiguity: multiple parsing options: {}" ,
449
+ match next_eis. len( ) {
450
+ 0 => format!( "built-in NTs {}." , nts) ,
451
+ 1 => format!( "built-in NTs {} or 1 other option." , nts) ,
452
+ n => format!( "built-in NTs {} or {} other options." , nts, n) ,
473
453
}
474
- cur_eis. push ( ei) ;
454
+ ) ) ;
455
+ } else if bb_eis. is_empty ( ) && next_eis. is_empty ( ) {
456
+ return Failure ( parser. span , parser. token ) ;
457
+ } else if !next_eis. is_empty ( ) {
458
+ /* Now process the next token */
459
+ cur_eis. extend ( next_eis. drain ( ..) ) ;
460
+ parser. bump ( ) ;
461
+ } else /* bb_eis.len() == 1 */ {
462
+ let mut ei = bb_eis. pop ( ) . unwrap ( ) ;
463
+ if let TokenTree :: Token ( span, MatchNt ( _, ident) ) = ei. top_elts . get_tt ( ei. idx ) {
464
+ let match_cur = ei. match_cur ;
465
+ ei. matches [ match_cur] . push ( Rc :: new ( MatchedNonterminal (
466
+ Rc :: new ( parse_nt ( & mut parser, span, & ident. name . as_str ( ) ) ) ) ) ) ;
467
+ ei. idx += 1 ;
468
+ ei. match_cur += 1 ;
469
+ } else {
470
+ unreachable ! ( )
475
471
}
472
+ cur_eis. push ( ei) ;
476
473
}
477
474
478
475
assert ! ( !cur_eis. is_empty( ) ) ;
0 commit comments