Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/parser/src/grammar/expressions.rs')
| -rw-r--r-- | crates/parser/src/grammar/expressions.rs | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/crates/parser/src/grammar/expressions.rs b/crates/parser/src/grammar/expressions.rs index 3b3f11be13..03439b784d 100644 --- a/crates/parser/src/grammar/expressions.rs +++ b/crates/parser/src/grammar/expressions.rs @@ -339,13 +339,20 @@ fn lhs(p: &mut Parser<'_>, r: Restrictions) -> Option<(CompletedMarker, BlockLik // // raw reference operator // let _ = &raw mut foo; // let _ = &raw const foo; + // let _ = &raw foo; // } T![&] => { m = p.start(); p.bump(T![&]); - if p.at_contextual_kw(T![raw]) && [T![mut], T![const]].contains(&p.nth(1)) { - p.bump_remap(T![raw]); - p.bump_any(); + if p.at_contextual_kw(T![raw]) { + if [T![mut], T![const]].contains(&p.nth(1)) { + p.bump_remap(T![raw]); + p.bump_any(); + } else if p.nth_at(1, SyntaxKind::IDENT) { + // we treat raw as keyword in this case + // &raw foo; + p.bump_remap(T![raw]); + } } else { p.eat(T![mut]); } |