Fix macro_rules not accepting brackets or parentheses

This commit is contained in:
Lukas Wirth 2020-12-24 09:26:03 +01:00
parent fd1fcf2c2e
commit 3e0bb89541
3 changed files with 66 additions and 2 deletions

View file

@ -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);
}