diff options
Diffstat (limited to 'src/grammar')
-rw-r--r-- | src/grammar/expressions.rs | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/grammar/expressions.rs b/src/grammar/expressions.rs index c638e8b99..c0eb0e756 100644 --- a/src/grammar/expressions.rs +++ b/src/grammar/expressions.rs | |||
@@ -162,6 +162,7 @@ fn atom_expr(p: &mut Parser) -> Option<CompletedMarker> { | |||
162 | let done = match p.current() { | 162 | let done = match p.current() { |
163 | L_PAREN => tuple_expr(p), | 163 | L_PAREN => tuple_expr(p), |
164 | PIPE => lambda_expr(p), | 164 | PIPE => lambda_expr(p), |
165 | MOVE_KW if p.nth(1) == PIPE => lambda_expr(p), | ||
165 | IF_KW => if_expr(p), | 166 | IF_KW => if_expr(p), |
166 | _ => { | 167 | _ => { |
167 | p.err_and_bump("expected expression"); | 168 | p.err_and_bump("expected expression"); |
@@ -184,11 +185,12 @@ fn tuple_expr(p: &mut Parser) -> CompletedMarker { | |||
184 | // || (); | 185 | // || (); |
185 | // || -> i32 { 92 }; | 186 | // || -> i32 { 92 }; |
186 | // |x| x; | 187 | // |x| x; |
187 | // |x: i32,| x; | 188 | // move |x: i32,| x; |
188 | // } | 189 | // } |
189 | fn lambda_expr(p: &mut Parser) -> CompletedMarker { | 190 | fn lambda_expr(p: &mut Parser) -> CompletedMarker { |
190 | assert!(p.at(PIPE)); | 191 | assert!(p.at(PIPE) || (p.at(MOVE_KW) && p.nth(1) == PIPE)); |
191 | let m = p.start(); | 192 | let m = p.start(); |
193 | p.eat(MOVE_KW); | ||
192 | params::param_list_opt_types(p); | 194 | params::param_list_opt_types(p); |
193 | if fn_ret_type(p) { | 195 | if fn_ret_type(p) { |
194 | block(p); | 196 | block(p); |