@@ -435,7 +435,8 @@ fn check_lhs_no_empty_seq(sess: &ParseSess, tts: &[quoted::TokenTree]) -> bool {
435435 match * seq_tt {
436436 TokenTree :: MetaVarDecl ( _, _, id) => id. name == "vis" ,
437437 TokenTree :: Sequence ( _, ref sub_seq) =>
438- sub_seq. op == quoted:: KleeneOp :: ZeroOrMore ,
438+ sub_seq. op == quoted:: KleeneOp :: ZeroOrMore
439+ || sub_seq. op == quoted:: KleeneOp :: ZeroOrOne ,
439440 _ => false ,
440441 }
441442 } ) {
@@ -543,7 +544,10 @@ impl FirstSets {
543544 }
544545
545546 // Reverse scan: Sequence comes before `first`.
546- if subfirst. maybe_empty || seq_rep. op == quoted:: KleeneOp :: ZeroOrMore {
547+ if subfirst. maybe_empty
548+ || seq_rep. op == quoted:: KleeneOp :: ZeroOrMore
549+ || seq_rep. op == quoted:: KleeneOp :: ZeroOrOne
550+ {
547551 // If sequence is potentially empty, then
548552 // union them (preserving first emptiness).
549553 first. add_all ( & TokenSet { maybe_empty : true , ..subfirst } ) ;
@@ -591,8 +595,10 @@ impl FirstSets {
591595
592596 assert ! ( first. maybe_empty) ;
593597 first. add_all ( subfirst) ;
594- if subfirst. maybe_empty ||
595- seq_rep. op == quoted:: KleeneOp :: ZeroOrMore {
598+ if subfirst. maybe_empty
599+ || seq_rep. op == quoted:: KleeneOp :: ZeroOrMore
600+ || seq_rep. op == quoted:: KleeneOp :: ZeroOrOne
601+ {
596602 // continue scanning for more first
597603 // tokens, but also make sure we
598604 // restore empty-tracking state
0 commit comments