From 3a7f07c62d3dd253d63c483ee291d9471f539479 Mon Sep 17 00:00:00 2001 From: Unreal Hoang Date: Sat, 20 Jul 2019 17:41:31 +0900 Subject: add await to syntax, parser for await_expr --- crates/ra_parser/src/grammar/expressions.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'crates/ra_parser/src/grammar/expressions.rs') diff --git a/crates/ra_parser/src/grammar/expressions.rs b/crates/ra_parser/src/grammar/expressions.rs index 298030cb9..3e49e70c7 100644 --- a/crates/ra_parser/src/grammar/expressions.rs +++ b/crates/ra_parser/src/grammar/expressions.rs @@ -393,6 +393,18 @@ fn postfix_expr( T![.] if p.nth(1) == IDENT && (p.nth(2) == T!['('] || p.nth(2) == T![::]) => { method_call_expr(p, lhs) } + T![.] if p.nth(1) == AWAIT_KW => { + // test await_expr + // fn foo() { + // x.await; + // x.0.await; + // x.0().await?.hello(); + // } + let m = lhs.precede(p); + p.bump(); + p.bump(); + m.complete(p, AWAIT_EXPR) + } T![.] => field_expr(p, lhs), // test postfix_range // fn foo() { let x = 1..; } -- cgit v1.2.3