diff options
author | robojumper <[email protected]> | 2020-05-28 20:42:22 +0100 |
---|---|---|
committer | robojumper <[email protected]> | 2020-05-28 20:42:22 +0100 |
commit | 367487fe88dca78cffad5138673d5259f7f7ba6b (patch) | |
tree | 2846ebee3a16875674aed26b534f905a30cb598f /crates/ra_parser | |
parent | 190a0595a478d059fdd95a179fe38d59cb6379be (diff) |
Support raw_ref_op's raw reference operator
Diffstat (limited to 'crates/ra_parser')
-rw-r--r-- | crates/ra_parser/src/grammar/expressions.rs | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/crates/ra_parser/src/grammar/expressions.rs b/crates/ra_parser/src/grammar/expressions.rs index 34f039768..d6e8df32a 100644 --- a/crates/ra_parser/src/grammar/expressions.rs +++ b/crates/ra_parser/src/grammar/expressions.rs | |||
@@ -325,13 +325,27 @@ fn lhs(p: &mut Parser, r: Restrictions) -> Option<(CompletedMarker, BlockLike)> | |||
325 | let kind = match p.current() { | 325 | let kind = match p.current() { |
326 | // test ref_expr | 326 | // test ref_expr |
327 | // fn foo() { | 327 | // fn foo() { |
328 | // // reference operator | ||
328 | // let _ = &1; | 329 | // let _ = &1; |
329 | // let _ = &mut &f(); | 330 | // let _ = &mut &f(); |
331 | // let _ = &raw; | ||
332 | // let _ = &raw.0; | ||
333 | // // raw reference operator | ||
334 | // let _ = &raw mut foo; | ||
335 | // let _ = &raw const foo; | ||
330 | // } | 336 | // } |
331 | T![&] => { | 337 | T![&] => { |
332 | m = p.start(); | 338 | m = p.start(); |
333 | p.bump(T![&]); | 339 | p.bump(T![&]); |
334 | p.eat(T![mut]); | 340 | if p.at(IDENT) |
341 | && p.at_contextual_kw("raw") | ||
342 | && (p.nth_at(1, T![mut]) || p.nth_at(1, T![const])) | ||
343 | { | ||
344 | p.bump_remap(T![raw]); | ||
345 | p.bump_any(); | ||
346 | } else { | ||
347 | p.eat(T![mut]); | ||
348 | } | ||
335 | REF_EXPR | 349 | REF_EXPR |
336 | } | 350 | } |
337 | // test unary_expr | 351 | // test unary_expr |