From 2efdf41bdb178ebf1ff0f8e3b335f491c84d7fa3 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Mon, 11 Feb 2019 19:23:13 +0300 Subject: make macro a NameOwner --- crates/ra_syntax/src/ast/generated.rs | 1 + crates/ra_syntax/src/grammar.ron | 5 ++++- crates/ra_syntax/src/grammar/items.rs | 4 +++- 3 files changed, 8 insertions(+), 2 deletions(-) (limited to 'crates/ra_syntax/src') diff --git a/crates/ra_syntax/src/ast/generated.rs b/crates/ra_syntax/src/ast/generated.rs index 256277609..d2b080743 100644 --- a/crates/ra_syntax/src/ast/generated.rs +++ b/crates/ra_syntax/src/ast/generated.rs @@ -1908,6 +1908,7 @@ impl ToOwned for MacroCall { } +impl ast::NameOwner for MacroCall {} impl MacroCall { pub fn token_tree(&self) -> Option<&TokenTree> { super::child_opt(self) diff --git a/crates/ra_syntax/src/grammar.ron b/crates/ra_syntax/src/grammar.ron index d428bc595..2e4b2d776 100644 --- a/crates/ra_syntax/src/grammar.ron +++ b/crates/ra_syntax/src/grammar.ron @@ -545,7 +545,10 @@ Grammar( "Visibility": (), "Name": (), "NameRef": (), - "MacroCall": ( options: [ "TokenTree", "Path" ] ), + "MacroCall": ( + traits: [ "NameOwner" ], + options: [ "TokenTree", "Path" ], + ), "Attr": ( options: [ ["value", "TokenTree"] ] ), "TokenTree": (), "TypeParamList": ( diff --git a/crates/ra_syntax/src/grammar/items.rs b/crates/ra_syntax/src/grammar/items.rs index a61f260cf..4b962c1f3 100644 --- a/crates/ra_syntax/src/grammar/items.rs +++ b/crates/ra_syntax/src/grammar/items.rs @@ -347,7 +347,9 @@ fn macro_call(p: &mut Parser) -> BlockLike { pub(super) fn macro_call_after_excl(p: &mut Parser) -> BlockLike { p.expect(EXCL); - p.eat(IDENT); + if p.at(IDENT) { + name(p); + } match p.current() { L_CURLY => { token_tree(p); -- cgit v1.2.3