diff options
author | Aleksey Kladov <[email protected]> | 2018-10-15 18:52:56 +0100 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2018-10-15 18:52:56 +0100 |
commit | 376639c70f94f1f26c7fbd86a9b5adebfa400f44 (patch) | |
tree | a3fb5bd8864be8c44f2ca7fc9814700498fe98d4 /crates | |
parent | bb298158ebc7fc62cad1654c76dc582e6dc28f05 (diff) |
Parse crate paths in expressions
Diffstat (limited to 'crates')
3 files changed, 45 insertions, 1 deletions
diff --git a/crates/ra_syntax/src/grammar/expressions/atom.rs b/crates/ra_syntax/src/grammar/expressions/atom.rs index a720d255f..e21de68c5 100644 --- a/crates/ra_syntax/src/grammar/expressions/atom.rs +++ b/crates/ra_syntax/src/grammar/expressions/atom.rs | |||
@@ -30,7 +30,7 @@ pub(super) const ATOM_EXPR_FIRST: TokenSet = | |||
30 | token_set_union![ | 30 | token_set_union![ |
31 | LITERAL_FIRST, | 31 | LITERAL_FIRST, |
32 | token_set![L_CURLY, L_PAREN, L_BRACK, PIPE, MOVE_KW, IF_KW, WHILE_KW, MATCH_KW, UNSAFE_KW, | 32 | token_set![L_CURLY, L_PAREN, L_BRACK, PIPE, MOVE_KW, IF_KW, WHILE_KW, MATCH_KW, UNSAFE_KW, |
33 | RETURN_KW, IDENT, SELF_KW, SUPER_KW, COLONCOLON, BREAK_KW, CONTINUE_KW, LIFETIME ], | 33 | RETURN_KW, IDENT, SELF_KW, SUPER_KW, CRATE_KW, COLONCOLON, BREAK_KW, CONTINUE_KW, LIFETIME ], |
34 | ]; | 34 | ]; |
35 | 35 | ||
36 | const EXPR_RECOVERY_SET: TokenSet = | 36 | const EXPR_RECOVERY_SET: TokenSet = |
diff --git a/crates/ra_syntax/tests/data/parser/ok/0035_crate_path_in_call.rs b/crates/ra_syntax/tests/data/parser/ok/0035_crate_path_in_call.rs new file mode 100644 index 000000000..f1ed30220 --- /dev/null +++ b/crates/ra_syntax/tests/data/parser/ok/0035_crate_path_in_call.rs | |||
@@ -0,0 +1,3 @@ | |||
1 | fn main() { | ||
2 | make_query(crate::module_map::module_tree); | ||
3 | } | ||
diff --git a/crates/ra_syntax/tests/data/parser/ok/0035_crate_path_in_call.txt b/crates/ra_syntax/tests/data/parser/ok/0035_crate_path_in_call.txt new file mode 100644 index 000000000..364315180 --- /dev/null +++ b/crates/ra_syntax/tests/data/parser/ok/0035_crate_path_in_call.txt | |||
@@ -0,0 +1,41 @@ | |||
1 | ROOT@[0; 62) | ||
2 | FN_DEF@[0; 61) | ||
3 | FN_KW@[0; 2) | ||
4 | WHITESPACE@[2; 3) | ||
5 | NAME@[3; 7) | ||
6 | IDENT@[3; 7) "main" | ||
7 | PARAM_LIST@[7; 9) | ||
8 | L_PAREN@[7; 8) | ||
9 | R_PAREN@[8; 9) | ||
10 | WHITESPACE@[9; 10) | ||
11 | BLOCK@[10; 61) | ||
12 | L_CURLY@[10; 11) | ||
13 | WHITESPACE@[11; 16) | ||
14 | EXPR_STMT@[16; 59) | ||
15 | CALL_EXPR@[16; 58) | ||
16 | PATH_EXPR@[16; 26) | ||
17 | PATH@[16; 26) | ||
18 | PATH_SEGMENT@[16; 26) | ||
19 | NAME_REF@[16; 26) | ||
20 | IDENT@[16; 26) "make_query" | ||
21 | ARG_LIST@[26; 58) | ||
22 | L_PAREN@[26; 27) | ||
23 | PATH_EXPR@[27; 57) | ||
24 | PATH@[27; 57) | ||
25 | PATH@[27; 44) | ||
26 | PATH@[27; 32) | ||
27 | PATH_SEGMENT@[27; 32) | ||
28 | CRATE_KW@[27; 32) | ||
29 | COLONCOLON@[32; 34) | ||
30 | PATH_SEGMENT@[34; 44) | ||
31 | NAME_REF@[34; 44) | ||
32 | IDENT@[34; 44) "module_map" | ||
33 | COLONCOLON@[44; 46) | ||
34 | PATH_SEGMENT@[46; 57) | ||
35 | NAME_REF@[46; 57) | ||
36 | IDENT@[46; 57) "module_tree" | ||
37 | R_PAREN@[57; 58) | ||
38 | SEMI@[58; 59) | ||
39 | WHITESPACE@[59; 60) | ||
40 | R_CURLY@[60; 61) | ||
41 | WHITESPACE@[61; 62) | ||