aboutsummaryrefslogtreecommitdiff
path: root/src/parser/grammar
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2018-07-31 18:48:45 +0100
committerAleksey Kladov <[email protected]>2018-07-31 18:48:45 +0100
commitf4c106f86a4fbb91f36aac59a6a98fff9d3c5c40 (patch)
tree6d81877635b5b0c05553f9535322c3edb1d8639b /src/parser/grammar
parent599ca1ad890f7b8e1e3919f1727c21dad353f595 (diff)
Lifetimes in self param
Diffstat (limited to 'src/parser/grammar')
-rw-r--r--src/parser/grammar/mod.rs14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/parser/grammar/mod.rs b/src/parser/grammar/mod.rs
index b8847fb68..53ef28181 100644
--- a/src/parser/grammar/mod.rs
+++ b/src/parser/grammar/mod.rs
@@ -126,15 +126,19 @@ fn fn_value_parameters(p: &mut Parser) {
126 // impl S { 126 // impl S {
127 // fn a(self) {} 127 // fn a(self) {}
128 // fn b(&self,) {} 128 // fn b(&self,) {}
129 // fn c(&mut self, x: i32) {} 129 // fn c(&'a self,) {}
130 // fn d(&'a mut self, x: i32) {}
130 // } 131 // }
131 fn self_param(p: &mut Parser) { 132 fn self_param(p: &mut Parser) {
132 let la1 = p.nth(1); 133 let la1 = p.nth(1);
133 let la2 = p.nth(2); 134 let la2 = p.nth(2);
134 let n_toks = match (p.current(), la1, la2) { 135 let la3 = p.nth(3);
135 (SELF_KW, _, _) => 1, 136 let n_toks = match (p.current(), la1, la2, la3) {
136 (AMPERSAND, SELF_KW, _) => 2, 137 (SELF_KW, _, _, _) => 1,
137 (AMPERSAND, MUT_KW, SELF_KW) => 3, 138 (AMPERSAND, SELF_KW, _, _) => 2,
139 (AMPERSAND, MUT_KW, SELF_KW, _) => 3,
140 (AMPERSAND, LIFETIME, SELF_KW, _) => 3,
141 (AMPERSAND, LIFETIME, MUT_KW, SELF_KW) => 4,
138 _ => return, 142 _ => return,
139 }; 143 };
140 let m = p.start(); 144 let m = p.start();