diff options
Diffstat (limited to 'crates/ra_parser/src')
-rw-r--r-- | crates/ra_parser/src/grammar.rs | 7 | ||||
-rw-r--r-- | crates/ra_parser/src/grammar/expressions.rs | 16 |
2 files changed, 19 insertions, 4 deletions
diff --git a/crates/ra_parser/src/grammar.rs b/crates/ra_parser/src/grammar.rs index be0cd5661..293baecf6 100644 --- a/crates/ra_parser/src/grammar.rs +++ b/crates/ra_parser/src/grammar.rs | |||
@@ -18,9 +18,10 @@ | |||
18 | //! // fn foo() {} | 18 | //! // fn foo() {} |
19 | //! ``` | 19 | //! ``` |
20 | //! | 20 | //! |
21 | //! After adding a new inline-test, run `cargo collect-tests` to extract | 21 | //! After adding a new inline-test, run `cargo xtask codegen` to |
22 | //! it as a standalone text-fixture into `tests/data/parser/inline`, and | 22 | //! extract it as a standalone text-fixture into |
23 | //! run `cargo test` once to create the "gold" value. | 23 | //! `crates/ra_syntax/test_data/parser/`, and run `cargo test` once to |
24 | //! create the "gold" value. | ||
24 | //! | 25 | //! |
25 | //! Coding convention: rules like `where_clause` always produce either a | 26 | //! Coding convention: rules like `where_clause` always produce either a |
26 | //! node or an error, rules like `opt_where_clause` may produce nothing. | 27 | //! node or an error, rules like `opt_where_clause` may produce nothing. |
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 |