diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2019-12-22 08:05:02 +0000 |
---|---|---|
committer | GitHub <[email protected]> | 2019-12-22 08:05:02 +0000 |
commit | 436df298bac711e0a666e9bad1a32afe3ce0c358 (patch) | |
tree | e078f8a24afd6413afce96c90a85c6577ffc8662 /crates | |
parent | d33493d779ba573403804b8d78e9b72fcf98f894 (diff) | |
parent | 737045c1eac87ab78f0042340f0311d3679158b0 (diff) |
Merge #2642
2642: Use name instead of ident in parser for macro 2.0 syntax r=matklad a=edwin0cheng
Co-authored-by: Edwin Cheng <[email protected]>
Diffstat (limited to 'crates')
4 files changed, 11 insertions, 6 deletions
diff --git a/crates/ra_parser/src/grammar/items.rs b/crates/ra_parser/src/grammar/items.rs index 3c717e5f9..6e23d9b72 100644 --- a/crates/ra_parser/src/grammar/items.rs +++ b/crates/ra_parser/src/grammar/items.rs | |||
@@ -389,7 +389,7 @@ pub(crate) fn mod_item_list(p: &mut Parser) { | |||
389 | // macro m($i:ident) {} | 389 | // macro m($i:ident) {} |
390 | fn macro_def(p: &mut Parser, m: Marker) { | 390 | fn macro_def(p: &mut Parser, m: Marker) { |
391 | p.expect(T![macro]); | 391 | p.expect(T![macro]); |
392 | p.expect(IDENT); | 392 | name_r(p, ITEM_RECOVERY_SET); |
393 | if p.at(T!['{']) { | 393 | if p.at(T!['{']) { |
394 | token_tree(p); | 394 | token_tree(p); |
395 | } else if !p.at(T!['(']) { | 395 | } else if !p.at(T!['(']) { |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0147_macro_def.txt b/crates/ra_syntax/test_data/parser/inline/ok/0147_macro_def.txt index af1122bfa..3556099bd 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0147_macro_def.txt +++ b/crates/ra_syntax/test_data/parser/inline/ok/0147_macro_def.txt | |||
@@ -2,7 +2,8 @@ SOURCE_FILE@[0; 50) | |||
2 | MACRO_DEF@[0; 28) | 2 | MACRO_DEF@[0; 28) |
3 | MACRO_KW@[0; 5) "macro" | 3 | MACRO_KW@[0; 5) "macro" |
4 | WHITESPACE@[5; 6) " " | 4 | WHITESPACE@[5; 6) " " |
5 | IDENT@[6; 7) "m" | 5 | NAME@[6; 7) |
6 | IDENT@[6; 7) "m" | ||
6 | WHITESPACE@[7; 8) " " | 7 | WHITESPACE@[7; 8) " " |
7 | TOKEN_TREE@[8; 28) | 8 | TOKEN_TREE@[8; 28) |
8 | L_CURLY@[8; 9) "{" | 9 | L_CURLY@[8; 9) "{" |
@@ -27,7 +28,8 @@ SOURCE_FILE@[0; 50) | |||
27 | MACRO_DEF@[29; 49) | 28 | MACRO_DEF@[29; 49) |
28 | MACRO_KW@[29; 34) "macro" | 29 | MACRO_KW@[29; 34) "macro" |
29 | WHITESPACE@[34; 35) " " | 30 | WHITESPACE@[34; 35) " " |
30 | IDENT@[35; 36) "m" | 31 | NAME@[35; 36) |
32 | IDENT@[35; 36) "m" | ||
31 | TOKEN_TREE@[36; 49) | 33 | TOKEN_TREE@[36; 49) |
32 | TOKEN_TREE@[36; 46) | 34 | TOKEN_TREE@[36; 46) |
33 | L_PAREN@[36; 37) "(" | 35 | L_PAREN@[36; 37) "(" |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0148_pub_macro_def.txt b/crates/ra_syntax/test_data/parser/inline/ok/0148_pub_macro_def.txt index 985f61f89..cfd79d9c2 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0148_pub_macro_def.txt +++ b/crates/ra_syntax/test_data/parser/inline/ok/0148_pub_macro_def.txt | |||
@@ -5,7 +5,8 @@ SOURCE_FILE@[0; 24) | |||
5 | WHITESPACE@[3; 4) " " | 5 | WHITESPACE@[3; 4) " " |
6 | MACRO_KW@[4; 9) "macro" | 6 | MACRO_KW@[4; 9) "macro" |
7 | WHITESPACE@[9; 10) " " | 7 | WHITESPACE@[9; 10) " " |
8 | IDENT@[10; 11) "m" | 8 | NAME@[10; 11) |
9 | IDENT@[10; 11) "m" | ||
9 | TOKEN_TREE@[11; 23) | 10 | TOKEN_TREE@[11; 23) |
10 | TOKEN_TREE@[11; 20) | 11 | TOKEN_TREE@[11; 20) |
11 | L_PAREN@[11; 12) "(" | 12 | L_PAREN@[11; 12) "(" |
diff --git a/crates/ra_syntax/test_data/parser/ok/0062_macro_2.0.txt b/crates/ra_syntax/test_data/parser/ok/0062_macro_2.0.txt index 158af85f5..2be523fc3 100644 --- a/crates/ra_syntax/test_data/parser/ok/0062_macro_2.0.txt +++ b/crates/ra_syntax/test_data/parser/ok/0062_macro_2.0.txt | |||
@@ -2,7 +2,8 @@ SOURCE_FILE@[0; 349) | |||
2 | MACRO_DEF@[0; 93) | 2 | MACRO_DEF@[0; 93) |
3 | MACRO_KW@[0; 5) "macro" | 3 | MACRO_KW@[0; 5) "macro" |
4 | WHITESPACE@[5; 6) " " | 4 | WHITESPACE@[5; 6) " " |
5 | IDENT@[6; 21) "parse_use_trees" | 5 | NAME@[6; 21) |
6 | IDENT@[6; 21) "parse_use_trees" | ||
6 | TOKEN_TREE@[21; 93) | 7 | TOKEN_TREE@[21; 93) |
7 | TOKEN_TREE@[21; 41) | 8 | TOKEN_TREE@[21; 41) |
8 | L_PAREN@[21; 22) "(" | 9 | L_PAREN@[21; 22) "(" |
@@ -75,7 +76,8 @@ SOURCE_FILE@[0; 349) | |||
75 | MACRO_DEF@[134; 346) | 76 | MACRO_DEF@[134; 346) |
76 | MACRO_KW@[134; 139) "macro" | 77 | MACRO_KW@[134; 139) "macro" |
77 | WHITESPACE@[139; 140) " " | 78 | WHITESPACE@[139; 140) " " |
78 | IDENT@[140; 150) "test_merge" | 79 | NAME@[140; 150) |
80 | IDENT@[140; 150) "test_merge" | ||
79 | TOKEN_TREE@[150; 346) | 81 | TOKEN_TREE@[150; 346) |
80 | TOKEN_TREE@[150; 203) | 82 | TOKEN_TREE@[150; 203) |
81 | L_PAREN@[150; 151) "(" | 83 | L_PAREN@[150; 151) "(" |