aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_parser/src
diff options
context:
space:
mode:
authorUnreal Hoang <[email protected]>2019-07-20 09:41:31 +0100
committerUnreal Hoang <[email protected]>2019-07-20 09:41:31 +0100
commit3a7f07c62d3dd253d63c483ee291d9471f539479 (patch)
tree7a717bb2a51489b4e1bc50895bff45f1e217f15c /crates/ra_parser/src
parente18f8495d6569f4fc0b7457b65a1d199cf7b5974 (diff)
add await to syntax, parser for await_expr
Diffstat (limited to 'crates/ra_parser/src')
-rw-r--r--crates/ra_parser/src/grammar/expressions.rs12
-rw-r--r--crates/ra_parser/src/syntax_kind/generated.rs7
2 files changed, 19 insertions, 0 deletions
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(
393 T![.] if p.nth(1) == IDENT && (p.nth(2) == T!['('] || p.nth(2) == T![::]) => { 393 T![.] if p.nth(1) == IDENT && (p.nth(2) == T!['('] || p.nth(2) == T![::]) => {
394 method_call_expr(p, lhs) 394 method_call_expr(p, lhs)
395 } 395 }
396 T![.] if p.nth(1) == AWAIT_KW => {
397 // test await_expr
398 // fn foo() {
399 // x.await;
400 // x.0.await;
401 // x.0().await?.hello();
402 // }
403 let m = lhs.precede(p);
404 p.bump();
405 p.bump();
406 m.complete(p, AWAIT_EXPR)
407 }
396 T![.] => field_expr(p, lhs), 408 T![.] => field_expr(p, lhs),
397 // test postfix_range 409 // test postfix_range
398 // fn foo() { let x = 1..; } 410 // fn foo() { let x = 1..; }
diff --git a/crates/ra_parser/src/syntax_kind/generated.rs b/crates/ra_parser/src/syntax_kind/generated.rs
index 374fd5aec..4b5abb516 100644
--- a/crates/ra_parser/src/syntax_kind/generated.rs
+++ b/crates/ra_parser/src/syntax_kind/generated.rs
@@ -105,6 +105,7 @@ pub enum SyntaxKind {
105 RETURN_KW, 105 RETURN_KW,
106 TRY_KW, 106 TRY_KW,
107 BOX_KW, 107 BOX_KW,
108 AWAIT_KW,
108 AUTO_KW, 109 AUTO_KW,
109 DEFAULT_KW, 110 DEFAULT_KW,
110 EXISTENTIAL_KW, 111 EXISTENTIAL_KW,
@@ -193,6 +194,7 @@ pub enum SyntaxKind {
193 INDEX_EXPR, 194 INDEX_EXPR,
194 METHOD_CALL_EXPR, 195 METHOD_CALL_EXPR,
195 FIELD_EXPR, 196 FIELD_EXPR,
197 AWAIT_EXPR,
196 TRY_EXPR, 198 TRY_EXPR,
197 CAST_EXPR, 199 CAST_EXPR,
198 REF_EXPR, 200 REF_EXPR,
@@ -338,6 +340,7 @@ macro_rules! T {
338 (return) => { $crate::SyntaxKind::RETURN_KW }; 340 (return) => { $crate::SyntaxKind::RETURN_KW };
339 (try) => { $crate::SyntaxKind::TRY_KW }; 341 (try) => { $crate::SyntaxKind::TRY_KW };
340 (box) => { $crate::SyntaxKind::BOX_KW }; 342 (box) => { $crate::SyntaxKind::BOX_KW };
343 (await) => { $crate::SyntaxKind::AWAIT_KW };
341 (auto) => { $crate::SyntaxKind::AUTO_KW }; 344 (auto) => { $crate::SyntaxKind::AUTO_KW };
342 (default) => { $crate::SyntaxKind::DEFAULT_KW }; 345 (default) => { $crate::SyntaxKind::DEFAULT_KW };
343 (existential) => { $crate::SyntaxKind::EXISTENTIAL_KW }; 346 (existential) => { $crate::SyntaxKind::EXISTENTIAL_KW };
@@ -398,6 +401,7 @@ impl SyntaxKind {
398 | RETURN_KW 401 | RETURN_KW
399 | TRY_KW 402 | TRY_KW
400 | BOX_KW 403 | BOX_KW
404 | AWAIT_KW
401 | AUTO_KW 405 | AUTO_KW
402 | DEFAULT_KW 406 | DEFAULT_KW
403 | EXISTENTIAL_KW 407 | EXISTENTIAL_KW
@@ -572,6 +576,7 @@ impl SyntaxKind {
572 RETURN_KW => &SyntaxInfo { name: "RETURN_KW" }, 576 RETURN_KW => &SyntaxInfo { name: "RETURN_KW" },
573 TRY_KW => &SyntaxInfo { name: "TRY_KW" }, 577 TRY_KW => &SyntaxInfo { name: "TRY_KW" },
574 BOX_KW => &SyntaxInfo { name: "BOX_KW" }, 578 BOX_KW => &SyntaxInfo { name: "BOX_KW" },
579 AWAIT_KW => &SyntaxInfo { name: "AWAIT_KW" },
575 AUTO_KW => &SyntaxInfo { name: "AUTO_KW" }, 580 AUTO_KW => &SyntaxInfo { name: "AUTO_KW" },
576 DEFAULT_KW => &SyntaxInfo { name: "DEFAULT_KW" }, 581 DEFAULT_KW => &SyntaxInfo { name: "DEFAULT_KW" },
577 EXISTENTIAL_KW => &SyntaxInfo { name: "EXISTENTIAL_KW" }, 582 EXISTENTIAL_KW => &SyntaxInfo { name: "EXISTENTIAL_KW" },
@@ -660,6 +665,7 @@ impl SyntaxKind {
660 INDEX_EXPR => &SyntaxInfo { name: "INDEX_EXPR" }, 665 INDEX_EXPR => &SyntaxInfo { name: "INDEX_EXPR" },
661 METHOD_CALL_EXPR => &SyntaxInfo { name: "METHOD_CALL_EXPR" }, 666 METHOD_CALL_EXPR => &SyntaxInfo { name: "METHOD_CALL_EXPR" },
662 FIELD_EXPR => &SyntaxInfo { name: "FIELD_EXPR" }, 667 FIELD_EXPR => &SyntaxInfo { name: "FIELD_EXPR" },
668 AWAIT_EXPR => &SyntaxInfo { name: "AWAIT_EXPR" },
663 TRY_EXPR => &SyntaxInfo { name: "TRY_EXPR" }, 669 TRY_EXPR => &SyntaxInfo { name: "TRY_EXPR" },
664 CAST_EXPR => &SyntaxInfo { name: "CAST_EXPR" }, 670 CAST_EXPR => &SyntaxInfo { name: "CAST_EXPR" },
665 REF_EXPR => &SyntaxInfo { name: "REF_EXPR" }, 671 REF_EXPR => &SyntaxInfo { name: "REF_EXPR" },
@@ -752,6 +758,7 @@ impl SyntaxKind {
752 "return" => RETURN_KW, 758 "return" => RETURN_KW,
753 "try" => TRY_KW, 759 "try" => TRY_KW,
754 "box" => BOX_KW, 760 "box" => BOX_KW,
761 "await" => AWAIT_KW,
755 _ => return None, 762 _ => return None,
756 }; 763 };
757 Some(kw) 764 Some(kw)