From 737045c1eac87ab78f0042340f0311d3679158b0 Mon Sep 17 00:00:00 2001 From: Edwin Cheng Date: Sun, 22 Dec 2019 11:11:10 +0800 Subject: Use name instead of ident for macro 2.0 sytnax --- crates/ra_parser/src/grammar/items.rs | 2 +- crates/ra_syntax/test_data/parser/inline/ok/0147_macro_def.txt | 6 ++++-- crates/ra_syntax/test_data/parser/inline/ok/0148_pub_macro_def.txt | 3 ++- crates/ra_syntax/test_data/parser/ok/0062_macro_2.0.txt | 6 ++++-- 4 files changed, 11 insertions(+), 6 deletions(-) (limited to 'crates') 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) { // macro m($i:ident) {} fn macro_def(p: &mut Parser, m: Marker) { p.expect(T![macro]); - p.expect(IDENT); + name_r(p, ITEM_RECOVERY_SET); if p.at(T!['{']) { token_tree(p); } 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) MACRO_DEF@[0; 28) MACRO_KW@[0; 5) "macro" WHITESPACE@[5; 6) " " - IDENT@[6; 7) "m" + NAME@[6; 7) + IDENT@[6; 7) "m" WHITESPACE@[7; 8) " " TOKEN_TREE@[8; 28) L_CURLY@[8; 9) "{" @@ -27,7 +28,8 @@ SOURCE_FILE@[0; 50) MACRO_DEF@[29; 49) MACRO_KW@[29; 34) "macro" WHITESPACE@[34; 35) " " - IDENT@[35; 36) "m" + NAME@[35; 36) + IDENT@[35; 36) "m" TOKEN_TREE@[36; 49) TOKEN_TREE@[36; 46) 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) WHITESPACE@[3; 4) " " MACRO_KW@[4; 9) "macro" WHITESPACE@[9; 10) " " - IDENT@[10; 11) "m" + NAME@[10; 11) + IDENT@[10; 11) "m" TOKEN_TREE@[11; 23) TOKEN_TREE@[11; 20) 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) MACRO_DEF@[0; 93) MACRO_KW@[0; 5) "macro" WHITESPACE@[5; 6) " " - IDENT@[6; 21) "parse_use_trees" + NAME@[6; 21) + IDENT@[6; 21) "parse_use_trees" TOKEN_TREE@[21; 93) TOKEN_TREE@[21; 41) L_PAREN@[21; 22) "(" @@ -75,7 +76,8 @@ SOURCE_FILE@[0; 349) MACRO_DEF@[134; 346) MACRO_KW@[134; 139) "macro" WHITESPACE@[139; 140) " " - IDENT@[140; 150) "test_merge" + NAME@[140; 150) + IDENT@[140; 150) "test_merge" TOKEN_TREE@[150; 346) TOKEN_TREE@[150; 203) L_PAREN@[150; 151) "(" -- cgit v1.2.3