aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_syntax
diff options
context:
space:
mode:
authorbors[bot] <bors[bot]@users.noreply.github.com>2019-03-10 17:37:41 +0000
committerbors[bot] <bors[bot]@users.noreply.github.com>2019-03-10 17:37:41 +0000
commitf96df105ea6d27f295cc1c0a6cdb6c50979f67ed (patch)
treea1bb4699afbd53d1ccbfd3585fa15169f971571c /crates/ra_syntax
parent543f2ec8f63ca39182c2c33cbfd093bc008560e7 (diff)
parentcc9721996c4680e257db76aafea12a9565196d92 (diff)
Merge #956
956: Add async keyword r=c410-f3r a=c410-f3r Fixes #954. Co-authored-by: Caio <[email protected]>
Diffstat (limited to 'crates/ra_syntax')
-rw-r--r--crates/ra_syntax/src/grammar.ron1
-rw-r--r--crates/ra_syntax/tests/data/lexer/0011_keywords.rs2
-rw-r--r--crates/ra_syntax/tests/data/lexer/0011_keywords.txt2
-rw-r--r--crates/ra_syntax/tests/data/parser/inline/err/0007_async_without_semicolon.rs1
-rw-r--r--crates/ra_syntax/tests/data/parser/inline/err/0007_async_without_semicolon.txt31
-rw-r--r--crates/ra_syntax/tests/data/parser/inline/ok/0124_async_fn.rs1
-rw-r--r--crates/ra_syntax/tests/data/parser/inline/ok/0124_async_fn.txt16
7 files changed, 53 insertions, 1 deletions
diff --git a/crates/ra_syntax/src/grammar.ron b/crates/ra_syntax/src/grammar.ron
index b7a2d1c01..66f1339c1 100644
--- a/crates/ra_syntax/src/grammar.ron
+++ b/crates/ra_syntax/src/grammar.ron
@@ -59,6 +59,7 @@ Grammar(
59 [">>=", "SHREQ"], 59 [">>=", "SHREQ"],
60 ], 60 ],
61 keywords: [ 61 keywords: [
62 "async",
62 "use", 63 "use",
63 "fn", 64 "fn",
64 "struct", 65 "struct",
diff --git a/crates/ra_syntax/tests/data/lexer/0011_keywords.rs b/crates/ra_syntax/tests/data/lexer/0011_keywords.rs
index e6bf64d4d..1e91bff4e 100644
--- a/crates/ra_syntax/tests/data/lexer/0011_keywords.rs
+++ b/crates/ra_syntax/tests/data/lexer/0011_keywords.rs
@@ -1,3 +1,3 @@
1fn use struct trait enum impl true false as extern crate 1async fn use struct trait enum impl true false as extern crate
2mod pub self super in where for loop while if match const 2mod pub self super in where for loop while if match const
3static mut type ref let else move return 3static mut type ref let else move return
diff --git a/crates/ra_syntax/tests/data/lexer/0011_keywords.txt b/crates/ra_syntax/tests/data/lexer/0011_keywords.txt
index d6a1abe8a..22c00eefb 100644
--- a/crates/ra_syntax/tests/data/lexer/0011_keywords.txt
+++ b/crates/ra_syntax/tests/data/lexer/0011_keywords.txt
@@ -1,3 +1,5 @@
1ASYNC_KW 5 "async"
2WHITESPACE 1 " "
1FN_KW 2 "fn" 3FN_KW 2 "fn"
2WHITESPACE 1 " " 4WHITESPACE 1 " "
3USE_KW 3 "use" 5USE_KW 3 "use"
diff --git a/crates/ra_syntax/tests/data/parser/inline/err/0007_async_without_semicolon.rs b/crates/ra_syntax/tests/data/parser/inline/err/0007_async_without_semicolon.rs
new file mode 100644
index 000000000..9a423248c
--- /dev/null
+++ b/crates/ra_syntax/tests/data/parser/inline/err/0007_async_without_semicolon.rs
@@ -0,0 +1 @@
fn foo() { let _ = async {} }
diff --git a/crates/ra_syntax/tests/data/parser/inline/err/0007_async_without_semicolon.txt b/crates/ra_syntax/tests/data/parser/inline/err/0007_async_without_semicolon.txt
new file mode 100644
index 000000000..bb9a2d029
--- /dev/null
+++ b/crates/ra_syntax/tests/data/parser/inline/err/0007_async_without_semicolon.txt
@@ -0,0 +1,31 @@
1SOURCE_FILE@[0; 30)
2 FN_DEF@[0; 29)
3 FN_KW@[0; 2)
4 WHITESPACE@[2; 3)
5 NAME@[3; 6)
6 IDENT@[3; 6) "foo"
7 PARAM_LIST@[6; 8)
8 L_PAREN@[6; 7)
9 R_PAREN@[7; 8)
10 WHITESPACE@[8; 9)
11 BLOCK@[9; 29)
12 L_CURLY@[9; 10)
13 WHITESPACE@[10; 11)
14 LET_STMT@[11; 27)
15 LET_KW@[11; 14)
16 WHITESPACE@[14; 15)
17 PLACEHOLDER_PAT@[15; 16)
18 UNDERSCORE@[15; 16)
19 WHITESPACE@[16; 17)
20 EQ@[17; 18)
21 WHITESPACE@[18; 19)
22 BLOCK_EXPR@[19; 27)
23 ASYNC_KW@[19; 24)
24 WHITESPACE@[24; 25)
25 BLOCK@[25; 27)
26 L_CURLY@[25; 26)
27 R_CURLY@[26; 27)
28 err: `expected SEMI`
29 WHITESPACE@[27; 28)
30 R_CURLY@[28; 29)
31 WHITESPACE@[29; 30)
diff --git a/crates/ra_syntax/tests/data/parser/inline/ok/0124_async_fn.rs b/crates/ra_syntax/tests/data/parser/inline/ok/0124_async_fn.rs
new file mode 100644
index 000000000..f4adcb62b
--- /dev/null
+++ b/crates/ra_syntax/tests/data/parser/inline/ok/0124_async_fn.rs
@@ -0,0 +1 @@
async fn foo() {}
diff --git a/crates/ra_syntax/tests/data/parser/inline/ok/0124_async_fn.txt b/crates/ra_syntax/tests/data/parser/inline/ok/0124_async_fn.txt
new file mode 100644
index 000000000..d1a706ecc
--- /dev/null
+++ b/crates/ra_syntax/tests/data/parser/inline/ok/0124_async_fn.txt
@@ -0,0 +1,16 @@
1SOURCE_FILE@[0; 18)
2 FN_DEF@[0; 17)
3 ASYNC_KW@[0; 5)
4 WHITESPACE@[5; 6)
5 FN_KW@[6; 8)
6 WHITESPACE@[8; 9)
7 NAME@[9; 12)
8 IDENT@[9; 12) "foo"
9 PARAM_LIST@[12; 14)
10 L_PAREN@[12; 13)
11 R_PAREN@[13; 14)
12 WHITESPACE@[14; 15)
13 BLOCK@[15; 17)
14 L_CURLY@[15; 16)
15 R_CURLY@[16; 17)
16 WHITESPACE@[17; 18)