aboutsummaryrefslogtreecommitdiff
path: root/src/parser/grammar/patterns.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/parser/grammar/patterns.rs')
-rw-r--r--src/parser/grammar/patterns.rs12
1 files changed, 8 insertions, 4 deletions
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) {
4 match p.current() { 4 match p.current() {
5 UNDERSCORE => placeholder_pat(p), 5 UNDERSCORE => placeholder_pat(p),
6 AMPERSAND => ref_pat(p), 6 AMPERSAND => ref_pat(p),
7 IDENT | REF_KW => bind_pat(p), 7 IDENT | REF_KW | MUT_KW => bind_pat(p),
8 _ => p.err_and_bump("expected pattern"), 8 _ => p.err_and_bump("expected pattern"),
9 } 9 }
10} 10}
@@ -35,14 +35,18 @@ fn ref_pat(p: &mut Parser) {
35// test bind_pat 35// test bind_pat
36// fn main() { 36// fn main() {
37// let a = (); 37// let a = ();
38// let ref b = (); 38// let mut b = ();
39// let ref mut c = (); 39// let ref c = ();
40// let d @ _ = (); 40// let ref mut d = ();
41// let e @ _ = ();
42// let ref mut f @ g @ _ = ();
41// } 43// }
42fn bind_pat(p: &mut Parser) { 44fn bind_pat(p: &mut Parser) {
43 let m = p.start(); 45 let m = p.start();
44 if p.eat(REF_KW) { 46 if p.eat(REF_KW) {
45 p.eat(MUT_KW); 47 p.eat(MUT_KW);
48 } else {
49 p.eat(MUT_KW);
46 } 50 }
47 name(p); 51 name(p);
48 if p.eat(AT) { 52 if p.eat(AT) {