@@ -435,7 +435,8 @@ fn check_lhs_no_empty_seq(sess: &ParseSess, tts: &[quoted::TokenTree]) -> bool {
435
435
match * seq_tt {
436
436
TokenTree :: MetaVarDecl ( _, _, id) => id. name == "vis" ,
437
437
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 ,
439
440
_ => false ,
440
441
}
441
442
} ) {
@@ -543,7 +544,10 @@ impl FirstSets {
543
544
}
544
545
545
546
// 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
+ {
547
551
// If sequence is potentially empty, then
548
552
// union them (preserving first emptiness).
549
553
first. add_all ( & TokenSet { maybe_empty : true , ..subfirst } ) ;
@@ -591,8 +595,10 @@ impl FirstSets {
591
595
592
596
assert ! ( first. maybe_empty) ;
593
597
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
+ {
596
602
// continue scanning for more first
597
603
// tokens, but also make sure we
598
604
// restore empty-tracking state
0 commit comments