From 45c4f620b1c5b8e462875b6e372db0e849bd6170 Mon Sep 17 00:00:00 2001 From: Edwin Cheng Date: Thu, 30 Apr 2020 22:07:46 +0800 Subject: Special-case try macro_rules --- crates/ra_parser/src/grammar/items.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'crates/ra_parser') diff --git a/crates/ra_parser/src/grammar/items.rs b/crates/ra_parser/src/grammar/items.rs index 433ed6812..1503a8730 100644 --- a/crates/ra_parser/src/grammar/items.rs +++ b/crates/ra_parser/src/grammar/items.rs @@ -415,6 +415,17 @@ pub(super) fn macro_call_after_excl(p: &mut Parser) -> BlockLike { if p.at(IDENT) { name(p); } + // Special-case `macro_rules! try`. + // This is a hack until we do proper edition support + + // test try_macro_rules + // macro_rules! try { () => {} } + if p.at(T![try]) { + let m = p.start(); + p.bump_remap(IDENT); + m.complete(p, NAME); + } + match p.current() { T!['{'] => { token_tree(p); -- cgit v1.2.3