Simplify pattern grammar by allowing nested leading vert
Along the way, we also implement a handful of diagnostics improvements and fixes, particularly with respect to the special handling of `||` in place of `|` and when there are leading verts in function params, which don't allow top-level or-patterns anyway.
This commit is contained in:
@@ -120,9 +120,9 @@ impl<'a> Parser<'a> {
|
||||
},
|
||||
NonterminalKind::Pat2018 { .. } | NonterminalKind::Pat2021 { .. } => {
|
||||
token::NtPat(self.collect_tokens_no_attrs(|this| match kind {
|
||||
NonterminalKind::Pat2018 { .. } => this.parse_pat(None),
|
||||
NonterminalKind::Pat2018 { .. } => this.parse_pat_no_top_alt(None),
|
||||
NonterminalKind::Pat2021 { .. } => {
|
||||
this.parse_top_pat(GateOr::Yes, RecoverComma::No)
|
||||
this.parse_pat_allow_top_alt(None, GateOr::Yes, RecoverComma::No)
|
||||
}
|
||||
_ => unreachable!(),
|
||||
})?)
|
||||
|
||||
Reference in New Issue
Block a user