From ad72699553c39f159f25a6dc7ecd5df953817407 Mon Sep 17 00:00:00 2001 From: Caio Date: Sat, 9 Mar 2019 20:40:22 -0300 Subject: Add async keyword --- crates/ra_syntax/src/grammar.ron | 1 + crates/ra_syntax/tests/data/lexer/0011_keywords.rs | 2 +- crates/ra_syntax/tests/data/lexer/0011_keywords.txt | 2 ++ .../tests/data/parser/inline/ok/0124_async_fn.rs | 1 + .../tests/data/parser/inline/ok/0124_async_fn.txt | 16 ++++++++++++++++ 5 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 crates/ra_syntax/tests/data/parser/inline/ok/0124_async_fn.rs create mode 100644 crates/ra_syntax/tests/data/parser/inline/ok/0124_async_fn.txt (limited to 'crates/ra_syntax') 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( [">>=", "SHREQ"], ], keywords: [ + "async", "use", "fn", "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 @@ -fn use struct trait enum impl true false as extern crate +async fn use struct trait enum impl true false as extern crate mod pub self super in where for loop while if match const static 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 @@ +ASYNC_KW 5 "async" +WHITESPACE 1 " " FN_KW 2 "fn" WHITESPACE 1 " " USE_KW 3 "use" 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 @@ +SOURCE_FILE@[0; 18) + FN_DEF@[0; 17) + ASYNC_KW@[0; 5) + WHITESPACE@[5; 6) + FN_KW@[6; 8) + WHITESPACE@[8; 9) + NAME@[9; 12) + IDENT@[9; 12) "foo" + PARAM_LIST@[12; 14) + L_PAREN@[12; 13) + R_PAREN@[13; 14) + WHITESPACE@[14; 15) + BLOCK@[15; 17) + L_CURLY@[15; 16) + R_CURLY@[16; 17) + WHITESPACE@[17; 18) -- cgit v1.2.3