From 580340d1b879a434302d314ef6cd9f4cae0cd57d Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Tue, 31 Jul 2018 15:30:11 +0300 Subject: mut bindings --- src/parser/grammar/patterns.rs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'src/parser/grammar') diff --git a/src/parser/grammar/patterns.rs b/src/parser/grammar/patterns.rs index 6e4f2236b..a5d13a124 100644 --- a/src/parser/grammar/patterns.rs +++ b/src/parser/grammar/patterns.rs @@ -4,7 +4,7 @@ pub(super) fn pattern(p: &mut Parser) { match p.current() { UNDERSCORE => placeholder_pat(p), AMPERSAND => ref_pat(p), - IDENT | REF_KW => bind_pat(p), + IDENT | REF_KW | MUT_KW => bind_pat(p), _ => p.err_and_bump("expected pattern"), } } @@ -35,14 +35,18 @@ fn ref_pat(p: &mut Parser) { // test bind_pat // fn main() { // let a = (); -// let ref b = (); -// let ref mut c = (); -// let d @ _ = (); +// let mut b = (); +// let ref c = (); +// let ref mut d = (); +// let e @ _ = (); +// let ref mut f @ g @ _ = (); // } fn bind_pat(p: &mut Parser) { let m = p.start(); if p.eat(REF_KW) { p.eat(MUT_KW); + } else { + p.eat(MUT_KW); } name(p); if p.eat(AT) { -- cgit v1.2.3