From 3e0bb895418b2042ee9cd14b2444a36c87a3f449 Mon Sep 17 00:00:00 2001 From: Lukas Wirth Date: Thu, 24 Dec 2020 09:26:03 +0100 Subject: Fix macro_rules not accepting brackets or parentheses --- crates/parser/src/grammar/items.rs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'crates/parser') diff --git a/crates/parser/src/grammar/items.rs b/crates/parser/src/grammar/items.rs index 72b73f891..cf4168d32 100644 --- a/crates/parser/src/grammar/items.rs +++ b/crates/parser/src/grammar/items.rs @@ -389,10 +389,15 @@ fn macro_rules(p: &mut Parser, m: Marker) { } match p.current() { - T!['{'] => { + // test macro_rules_non_brace + // macro_rules! m ( ($i:ident) => {} ); + // macro_rules! m [ ($i:ident) => {} ]; + T!['['] | T!['('] => { token_tree(p); + p.expect(T![;]); } - _ => p.error("expected `{`"), + T!['{'] => token_tree(p), + _ => p.error("expected `{`, `[`, `(`"), } m.complete(p, MACRO_RULES); } -- cgit v1.2.3