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:
parent
d1206f950f
commit
aee1e59e6f
18 changed files with 189 additions and 303 deletions
|
@ -220,7 +220,7 @@ impl<'a> Parser<'a> {
|
|||
/// Parses a local variable declaration.
|
||||
fn parse_local(&mut self, attrs: AttrVec) -> PResult<'a, P<Local>> {
|
||||
let lo = self.prev_token.span;
|
||||
let pat = self.parse_top_pat(GateOr::Yes, RecoverComma::Yes)?;
|
||||
let pat = self.parse_pat_allow_top_alt(None, GateOr::Yes, RecoverComma::Yes)?;
|
||||
|
||||
let (err, ty) = if self.eat(&token::Colon) {
|
||||
// Save the state of the parser before parsing type normally, in case there is a `:`
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue